Java Code Examples for java.util.logging.Logger

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project capedwarf-blue, under directory /cluster-tests/src/test/java/org/jboss/test/capedwarf/cluster/.

Source file: LoggingTestCase.java

  33 
vote

@InSequence(10) @Test @OperateOnDeployment("dep1") public void writeLogOnDep1(){
  clear(LogServiceFactory.getLogService());
  assertLogDoesntContain("hello");
  Logger log=Logger.getLogger(LoggingTestCase.class.getName());
  log.info("hello");
  waitForSync();
  flush(log);
  waitForSync();
  assertLogContains("hello");
}
 

Example 2

From project AdminCmd, under directory /src/main/java/be/Balor/bukkit/AdminCmd/.

Source file: ACHelper.java

  31 
vote

public synchronized void loadInfos(){
  itemBlacklist.addAll(getBlackListedItems());
  blockBlacklist=getBlackListedBlocks();
  groups=getGroupNames();
  alias.putAll(fManager.getAlias());
  addLocaleFromFile();
  kits=fManager.loadKits();
  deathMessages=fManager.loadDeathMessages();
  final Map<String,Ban> bans=dataManager.loadBan();
  for (  final Entry<String,Ban> ban : bans.entrySet()) {
    if (checkBan(ban.getValue())) {
      bannedPlayers.put(ban.getKey(),ban.getValue());
    }
  }
  if (pluginConfig.getBoolean("verboseLog",true)) {
    final Logger logger=coreInstance.getLogger();
    logger.info(itemBlacklist.size() + " blacklisted items loaded.");
    logger.info(blockBlacklist.size() + " blacklisted blocks loaded.");
    logger.info(alias.size() + " alias loaded.");
    logger.info(kits.size() + " kits loaded.");
    logger.info(bannedPlayers.size() + " banned players loaded.");
    logger.info(deathMessages.size() + " death messages loaded.");
  }
}
 

Example 3

From project Amoeba-for-Aladdin, under directory /src/java/com/meidusa/amoeba/aladdin/test/.

Source file: Log.java

  31 
vote

public static void main(String[] args){
  Logger logger=Logger.getLogger("sgg");
  try {
    Log.setLogingProperties(logger);
    logger.log(Level.INFO,"ddddd");
    logger.log(Level.INFO,"eeeeee");
    logger.log(Level.INFO,"ffffff");
    logger.log(Level.INFO,"gggggg");
    logger.log(Level.INFO,"hhhhhh");
  }
 catch (  SecurityException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}
 

Example 4

From project autopsy, under directory /KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/.

Source file: KeywordSearch.java

  31 
vote

@Override public void propertyChange(PropertyChangeEvent evt){
  String changed=evt.getPropertyName();
  Object oldValue=evt.getOldValue();
  Object newValue=evt.getNewValue();
  final Logger logger=Logger.getLogger(CaseChangeListener.class.getName());
  if (changed.equals(Case.CASE_CURRENT_CASE)) {
    if (newValue != null) {
      try {
        server.openCore();
      }
 catch (      Exception e) {
        logger.log(Level.WARNING,"Could not open core.");
      }
    }
 else     if (oldValue != null) {
      try {
        ResultWriter.stopAllWriters();
        Thread.sleep(2000);
        server.closeCore();
      }
 catch (      Exception e) {
        logger.log(Level.WARNING,"Could not close core.");
      }
    }
  }
}
 

Example 5

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/ui/.

Source file: WebLinkListener.java

  31 
vote

public void handleEvent(Event event){
  try {
    URL url=new URL(event.text);
    IWorkbenchBrowserSupport browserSupport=PlatformUI.getWorkbench().getBrowserSupport();
    int browserStyle=IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.AS_EXTERNAL | IWorkbenchBrowserSupport.STATUS| IWorkbenchBrowserSupport.NAVIGATION_BAR;
    IWebBrowser browser=browserSupport.createBrowser(browserStyle,null,null,null);
    browser.openURL(url);
    if (shellToClose != null) {
      shellToClose.close();
    }
  }
 catch (  Exception e) {
    Logger logger=Logger.getLogger(AwsAccountPreferencePage.class.getName());
    logger.warning("Unable to open link to '" + event.text + "': "+ e.getMessage());
  }
}
 

Example 6

From project BeeQueue, under directory /src/org/beequeue/util/.

Source file: LoggingUtil.java

  31 
vote

public static ConsoleHandler setLevelForConsoleHandler(Level level){
  Logger topLogger=java.util.logging.Logger.getLogger("");
  topLogger.setLevel(Level.ALL);
  ConsoleHandler consoleHandler=null;
  for (  Handler handler : topLogger.getHandlers()) {
    if (handler instanceof ConsoleHandler) {
      consoleHandler=(ConsoleHandler)handler;
      break;
    }
  }
  if (consoleHandler == null) {
    consoleHandler=new ConsoleHandler();
    topLogger.addHandler(consoleHandler);
  }
  consoleHandler.setLevel(level);
  return consoleHandler;
}
 

Example 7

From project ceres, under directory /ceres-core/src/main/java/com/bc/ceres/core/runtime/internal/.

Source file: ModuleClassLoader.java

  31 
vote

@Override protected String findLibrary(String libname){
  for (  URL url : nativeUrls) {
    if (url.toExternalForm().endsWith(System.mapLibraryName(libname))) {
      String absolutePath=UrlHelper.urlToFile(url).getAbsolutePath();
      Logger logger=Logger.getLogger(System.getProperty("ceres.context","ceres"));
      Throwable throwable=new Throwable("This is not an exception.");
      logger.log(Level.FINEST,"Native library found: " + absolutePath,throwable);
      return absolutePath;
    }
  }
  for (  ClassLoader classLoader : delegates) {
    if (classLoader instanceof ModuleClassLoader) {
      String path=((ModuleClassLoader)classLoader).findLibrary(libname);
      if (path != null) {
        return path;
      }
    }
  }
  ClassLoader parent=getParent();
  if (parent instanceof ModuleClassLoader) {
    String path=((ModuleClassLoader)parent).findLibrary(libname);
    if (path != null) {
      return path;
    }
  }
  return super.findLibrary(libname);
}
 

Example 8

From project activiti-webapp-rest-generic, under directory /activiti-webapp-rest/src/main/java/org/activiti/rest/api/task/.

Source file: TaskGet.java

  29 
vote

/** 
 * Colelcts details about a task for the webscript template.
 * @param req The webscripts request
 * @param status The webscripts status
 * @param cache The webscript cache
 * @param model The webscripts template model
 */
@Override protected void executeWebScript(ActivitiRequest req,Status status,Cache cache,Map<String,Object> model){
  String taskId=req.getMandatoryPathParameter("taskId");
  HumanTaskService humanTaskService=createHumanTaskService();
  TTask task=null;
  try {
    task=humanTaskService.getTaskInfo(taskId);
  }
 catch (  IllegalArgumentFault ex) {
    Logger.getLogger(TaskGet.class.getName()).log(Level.SEVERE,null,ex);
  }
  RestTask restTask=new RestTask(task);
  TaskFormData taskFormData=getFormService().getTaskFormData(taskId);
  if (taskFormData != null) {
    restTask.setFormResourceKey(taskFormData.getFormKey());
  }
  model.put("task",restTask);
}
 

Example 9

From project AdServing, under directory /modules/utilities/utils/src/main/java/net/mad/ads/base/utils/utils/logging/.

Source file: LogWrapper.java

  29 
vote

public void init(Class clazz,File logPropertiesFile){
  try {
    Properties prop=Properties2.loadProperties(logPropertiesFile);
    if (logger == null) {
      logger=Logger.getLogger(prop.getProperty(LOGGER_NAME));
      String fileName=prop.getProperty(LOG_FILE_NAME);
      RollingFileHandler rfh=new RollingFileHandler(fileName,".log");
      rfh.setFormatter(new CustomMessageFormatter(new MessageFormat(prop.getProperty(MESSAGE_FORMAT))));
      logger.setLevel(AdLevel.parse(prop.getProperty(LOG_LEVEL)));
      logger.addHandler(rfh);
    }
    this.className=clazz.getName();
  }
 catch (  FileNotFoundException fnfe) {
    fnfe.printStackTrace();
  }
catch (  IOException ioe) {
    ioe.printStackTrace();
  }
}
 

Example 10

From project AeminiumRuntime, under directory /src/aeminium/runtime/tests/.

Source file: BaseTest.java

  29 
vote

public BaseTest(){
  log=Logger.getLogger(this.getClass().getName());
  Handler conHdlr=new ConsoleHandler();
  conHdlr.setFormatter(new Formatter(){
    public String format(    LogRecord record){
      return "TEST " + record.getLevel() + "  :  "+ record.getMessage()+ "\n";
    }
  }
);
  log.setUseParentHandlers(false);
  log.addHandler(conHdlr);
  log.setLevel(Level.INFO);
}
 

Example 11

From project AmDroid, under directory /httpclientandroidlib/src/ch/boye/httpclientandroidlib/conn/ssl/.

Source file: AbstractVerifier.java

  29 
vote

/** 
 * Extracts the array of SubjectAlt DNS or IP names from an X509Certificate. Returns null if there aren't any.
 * @param cert X509Certificate
 * @param hostname
 * @return Array of SubjectALT DNS or IP names stored in the certificate.
 */
private static String[] getSubjectAlts(final X509Certificate cert,final String hostname){
  int subjectType;
  if (isIPAddress(hostname)) {
    subjectType=7;
  }
 else {
    subjectType=2;
  }
  LinkedList<String> subjectAltList=new LinkedList<String>();
  Collection<List<?>> c=null;
  try {
    c=cert.getSubjectAlternativeNames();
  }
 catch (  CertificateParsingException cpe) {
    Logger.getLogger(AbstractVerifier.class.getName()).log(Level.FINE,"Error parsing certificate.",cpe);
  }
  if (c != null) {
    for (    List<?> aC : c) {
      List<?> list=aC;
      int type=((Integer)list.get(0)).intValue();
      if (type == subjectType) {
        String s=(String)list.get(1);
        subjectAltList.add(s);
      }
    }
  }
  if (!subjectAltList.isEmpty()) {
    String[] subjectAlts=new String[subjectAltList.size()];
    subjectAltList.toArray(subjectAlts);
    return subjectAlts;
  }
 else {
    return null;
  }
}
 

Example 12

From project AntiCheat, under directory /src/main/java/net/h31ix/anticheat/manage/.

Source file: AnticheatManager.java

  29 
vote

public AnticheatManager(Anticheat instance,Logger logger){
  plugin=instance;
  fileLogger=Logger.getLogger("net.h31ix.anticheat.Anticheat");
  configuration=new Configuration(this);
  xrayTracker=new XRayTracker();
  userManager=new UserManager(configuration);
  checkManager=new CheckManager(this);
  backend=new Backend(this);
  try {
    File file=new File(plugin.getDataFolder() + "/log");
    if (!file.exists()) {
      file.mkdir();
    }
    fileHandler=new FileHandler(plugin.getDataFolder() + "/log/anticheat.log",true);
    fileHandler.setFormatter(new FileFormatter());
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,null,ex);
  }
  fileLogger.setUseParentHandlers(false);
  fileLogger.addHandler(fileHandler);
}
 

Example 13

From project apjp, under directory /APJP_REMOTE_JAVA/src/main/java/APJP/HTTP/.

Source file: HTTPServlet.java

  29 
vote

public void init(ServletConfig servletConfig) throws ServletException {
  super.init(servletConfig);
  logger=Logger.getLogger(HTTPServlet.class.getName());
  Properties properties=new Properties();
  try {
    properties.load(getServletContext().getResourceAsStream("/WEB-INF/APJP_REMOTE.properties"));
  }
 catch (  Exception e) {
    throw new ServletException(e);
  }
  APJP_KEY=properties.getProperty("APJP_KEY","");
  APJP_REMOTE_HTTP_SERVER_RESPONSE_PROPERTY_KEY=new String[5];
  APJP_REMOTE_HTTP_SERVER_RESPONSE_PROPERTY_VALUE=new String[5];
  for (int i=0; i < APJP_REMOTE_HTTP_SERVER_RESPONSE_PROPERTY_KEY.length; i=i + 1) {
    APJP_REMOTE_HTTP_SERVER_RESPONSE_PROPERTY_KEY[i]=properties.getProperty("APJP_REMOTE_HTTP_SERVER_RESPONSE_PROPERTY_" + (i + 1) + "_KEY","");
    APJP_REMOTE_HTTP_SERVER_RESPONSE_PROPERTY_VALUE[i]=properties.getProperty("APJP_REMOTE_HTTP_SERVER_RESPONSE_PROPERTY_" + (i + 1) + "_VALUE","");
  }
}
 

Example 14

From project archive-commons, under directory /archive-commons/src/main/java/org/archive/hadoop/.

Source file: ArchiveJSONViewLoader.java

  29 
vote

public ArchiveJSONViewLoader(String... fieldArgs){
  super();
  Logger.getLogger("org.archive").setLevel(Level.WARNING);
  mCacheProtoTuple=new ArrayList<Object>();
  cached=null;
  if (fieldArgs.length == 0) {
    LOG.info("Constructed with NO foo");
    throw new RuntimeException("No field definition");
  }
 else {
    if (LOG.isLoggable(Level.INFO)) {
      LOG.info("ArchiveJSONViewLoader:(" + StringUtils.join(fieldArgs,",") + ")");
    }
    view=new JSONView(fieldArgs);
  }
}
 

Example 15

From project AuthDB, under directory /src/main/java/com/authdb/.

Source file: AuthDB.java

  29 
vote

public void saveBasicConfig(){
  if (basicConfig == null || basicConfigurationFile == null) {
    return;
  }
  try {
    basicConfig.save(basicConfigurationFile);
  }
 catch (  IOException ex) {
    Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE,"Could not save config to " + basicConfigurationFile,ex);
  }
}
 

Example 16

From project AuthMe-Reloaded, under directory /src/main/java/uk/org/whoami/authme/settings/.

Source file: CustomConfiguration.java

  29 
vote

public void load(){
  try {
    super.load(configFile);
  }
 catch (  FileNotFoundException e) {
    Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE,"Could not find " + configFile.getName() + ", creating new one...");
    reload();
  }
catch (  IOException e) {
    Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE,"Could not load " + configFile.getName(),e);
  }
catch (  InvalidConfigurationException e) {
    Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE,configFile.getName() + " is no valid configuration file",e);
  }
}
 

Example 17

From project aws-tvm-anonymous, under directory /src/com/amazonaws/tvm/.

Source file: TokenVendingMachineLogger.java

  29 
vote

public synchronized static Logger getLogger(){
  if (null != logger) {
    return logger;
  }
  logger=Logger.getLogger("TokenVendingMachineLogger");
  FileHandler handler;
  try {
    handler=new FileHandler("MyLogFile.txt",true);
    SimpleFormatter formatter=new SimpleFormatter();
    handler.setFormatter(formatter);
    logger.addHandler(handler);
    logger.setLevel(Level.ALL);
  }
 catch (  SecurityException e) {
    System.err.println("Security exception while initialising logger : " + e.getMessage());
  }
catch (  IOException e) {
    System.err.println("IO exception while initialising logger : " + e.getMessage());
  }
  return logger;
}
 

Example 18

From project aws-tvm-identity, under directory /src/com/amazonaws/tvm/.

Source file: TokenVendingMachineLogger.java

  29 
vote

public synchronized static Logger getLogger(){
  if (null != logger) {
    return logger;
  }
  logger=Logger.getLogger("TokenVendingMachineLogger");
  FileHandler handler;
  try {
    handler=new FileHandler("MyLogFile.txt",true);
    SimpleFormatter formatter=new SimpleFormatter();
    handler.setFormatter(formatter);
    logger.addHandler(handler);
    logger.setLevel(Level.ALL);
  }
 catch (  SecurityException e) {
    System.err.println("Security exception while initialising logger : " + e.getMessage());
  }
catch (  IOException e) {
    System.err.println("IO exception while initialising logger : " + e.getMessage());
  }
  return logger;
}
 

Example 19

From project b3log-latke, under directory /latke/src/main/java/org/b3log/latke/mail/local/.

Source file: LocalMailService.java

  29 
vote

@Override public void send(final Message message) throws IOException {
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        new MailSender().sendMail(message);
      }
 catch (      final MessagingException e) {
        Logger.getLogger(LocalMailService.class.getName()).log(Level.SEVERE,"Sends mail failed",e);
      }
    }
  }
).start();
}
 

Example 20

From project backup-plugin, under directory /src/main/java/org/jvnet/hudson/plugins/backup/utils/compress/.

Source file: AbstractUnArchiver.java

  29 
vote

public void unArchive(File archive,String toDir) throws ArchiverException {
  org.codehaus.plexus.archiver.AbstractUnArchiver unarchiver=getUnArchiver();
  File destDir=new File(toDir);
  if (!destDir.exists()) {
    try {
      FileUtils.forceMkdir(destDir);
    }
 catch (    IOException e) {
      String message="Unable to created directory " + destDir.getAbsolutePath();
      LOGGER.severe(message);
      throw new ArchiverException(message,e);
    }
  }
  unarchiver.enableLogging(new ConsoleLogger(org.codehaus.plexus.logging.Logger.LEVEL_INFO,"UnArchiver"));
  unarchiver.setSourceFile(archive);
  unarchiver.setDestDirectory(destDir);
  try {
    unarchiver.extract();
  }
 catch (  org.codehaus.plexus.archiver.ArchiverException e) {
    String message="Unable to extract " + archive.getAbsolutePath() + " content to "+ toDir;
    LOGGER.log(Level.SEVERE,message,e);
    throw new ArchiverException(message,e);
  }
catch (  Exception e) {
    LOGGER.severe(e.getMessage());
  }
}
 

Example 21

From project Baseform-Epanet-Java-Library, under directory /src/org/addition/epanet/hydraulic/.

Source file: HydraulicSim.java

  29 
vote

/** 
 * Init hydraulic simulation, preparing the linear solver and the hydraulic structures wrappers.
 * @param net Hydraulic network reference.
 * @param log Logger reference.
 * @throws ENException
 */
public HydraulicSim(Network net,Logger log) throws ENException {
  List<Node> tmpNodes=new ArrayList<Node>(net.getNodes());
  List<Link> tmpLinks=new ArrayList<Link>(net.getLinks());
  running=false;
  logger=log;
  createSimulationNetwork(tmpNodes,tmpLinks,net);
}
 

Example 22

From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/utils/.

Source file: OperatorUtils.java

  29 
vote

/** 
 * Persist a product to disk (temp dir), disposes it, reads it in again and returns the new instance. May be used to get rid of all the tiles that are in use due to the given product.
 * @param product      A product to persist.
 * @param variableName The name of the persisted product file (tip: use the Product variable used in your source code).
 * @param logger       A logger.
 * @return A new product instance which contains everything that {@code product} contains.
 * @throws OperatorException If an I/O error occurs.
 */
public static Product persist(Product product,String variableName,Logger logger) throws OperatorException {
  if (product == null) {
    return null;
  }
  String oldName=product.getName();
  try {
    File file=new File(System.getProperty("java.io.tmpdir"),String.format("%s_%s.dim",variableName,Long.toHexString(System.nanoTime())));
    logger.info("Writing product " + oldName + " to "+ file);
    WriteOp writeOp=new WriteOp();
    writeOp.setFile(file);
    writeOp.setFormatName("BEAM-DIMAP");
    writeOp.setClearCacheAfterRowWrite(true);
    writeOp.setDeleteOutputOnFailure(false);
    writeOp.setWriteEntireTileRows(true);
    writeOp.setSourceProduct(product);
    writeOp.writeProduct(new PrintWriterProgressMonitor(System.out));
    product.dispose();
    logger.info("Product written. Now reading in again...");
    Product persistedProduct=ProductIO.readProduct(file);
    persistedProduct.setName(oldName);
    logger.info("Product read.");
    return persistedProduct;
  }
 catch (  IOException e) {
    throw new OperatorException(String.format("Failed to persist product %s: %s",oldName,e.getMessage()),e);
  }
}
 

Example 23

From project beam-third-party, under directory /beam-meris-veg/src/main/java/org/esa/beam/processor/baer/algorithm/.

Source file: BaerAlgorithm.java

  29 
vote

/** 
 * Constructs the object with default parameters
 */
public BaerAlgorithm(){
  _logger=Logger.getLogger(BaerConstants.LOGGER_NAME);
  _inputLocal=new double[BaerConstants.NUM_BANDS];
  _aeroRefl=new double[BaerConstants.NUM_BANDS];
  _weight=new double[BaerConstants.NUM_BANDS];
  _aot=new double[BaerConstants.NUM_BANDS];
  _flagAotOutOfRange=new int[BaerConstants.NUM_BANDS];
  _aertable=new double[BaerConstants.NUM_BANDS][3];
  _surfRefl=new double[BaerConstants.NUM_BANDS];
  _aotguess=new double[BaerConstants.NUM_BANDS];
  _aotTempxx=new double[BaerConstants.NUM_BANDS];
  _aotTempx=new double[BaerConstants.NUM_BANDS];
  _aotMin=new double[BaerConstants.NUM_BANDS];
  _lnLambda=new double[BaerConstants.NUM_BANDS];
  _lnAot=new double[BaerConstants.NUM_BANDS];
  _atm_corr_method="SMAC";
  _atm_cor_process=false;
  _vegSpectraNumber=1;
  _soilSpectraNumber=3;
  _reflVeg=new Spectrum[2];
  _reflSoil=new Spectrum[4];
}
 

Example 24

From project BetterShop_1, under directory /src/me/jascotty2/lib/bukkit/.

Source file: ServerInfo.java

  29 
vote

/** 
 * reads the server log for Bukkit Version
 * @param includeStart if true, will append a newline a & the last start timestamp
 * @return
 */
public static String getBukkitVersion(boolean includeStart){
  File slog=new File("server.log");
  if (slog.exists() && slog.canRead()) {
    FileReader fstream=null;
    try {
      String ver="";
      fstream=new FileReader(slog.getAbsolutePath());
      BufferedReader in=new BufferedReader(fstream);
      String line="";
      while ((line=in.readLine()) != null) {
        if (line.contains("This server is running Craftbukkit version git-Bukkit-")) {
          ver=line;
        }
      }
      if (ver.length() > 0) {
        return !includeStart ? ver.substring(ver.indexOf("git-Bukkit-")) : ver.substring(ver.indexOf("git-Bukkit-")) + "\nStartTime: " + ver.substring(0,19)+ "  ("+ serverRunTimeSpan(ver.substring(0,19))+ ")";
      }
 else {
        return "?";
      }
    }
 catch (    Exception ex) {
      Logger.getAnonymousLogger().log(Level.SEVERE,ex.getMessage(),ex);
    }
 finally {
      try {
        fstream.close();
      }
 catch (      IOException ex) {
      }
    }
  }
  return "?";
}
 

Example 25

From project BG7, under directory /src/com/era7/bioinfo/annotation/gb/.

Source file: ControlGenBankFilesQuality.java

  29 
vote

private static boolean controlaCalidadFiles(File gbFile,File xmlFile){
  System.out.println("xmlFile.getName() = " + xmlFile.getName());
  System.out.println("gbFile.getName() = " + gbFile.getName());
  BufferedReader reader=null;
  boolean noError=true;
  try {
    Annotation gbAnnotation=ImportGenBankFiles.importGenBankFile(gbFile);
    reader=new BufferedReader(new FileReader(xmlFile));
    StringBuilder stBuilder=new StringBuilder();
    String line=null;
    while ((line=reader.readLine()) != null) {
      stBuilder.append(line);
    }
    reader.close();
    Annotation xmlAnnotation=new Annotation(stBuilder.toString());
    PredictedGenes gbPredictedGenes=new PredictedGenes(gbAnnotation.asJDomElement().getChild(PredictedGenes.TAG_NAME));
    PredictedRnas gbPredictedRnas=new PredictedRnas(gbAnnotation.asJDomElement().getChild(PredictedRnas.TAG_NAME));
    PredictedGenes xmlPredictedGenes=new PredictedGenes(xmlAnnotation.asJDomElement().getChild(PredictedGenes.TAG_NAME));
    PredictedRnas xmlPredictedRnas=new PredictedRnas(xmlAnnotation.asJDomElement().getChild(PredictedRnas.TAG_NAME));
    System.out.println("Checking contig genes....");
    List<Element> xmlContigs=xmlPredictedGenes.asJDomElement().getChildren(ContigXML.TAG_NAME);
    List<Element> gbContigs=gbPredictedGenes.asJDomElement().getChildren(ContigXML.TAG_NAME);
    noError=noError && checkGenesContigs(xmlContigs,gbContigs);
    System.out.println("Checking contig rnas....");
    List<Element> xmlContigsRnas=xmlPredictedRnas.asJDomElement().getChildren(ContigXML.TAG_NAME);
    List<Element> gbContigsRnas=gbPredictedRnas.asJDomElement().getChildren(ContigXML.TAG_NAME);
    noError=noError && checkRnasContigs(xmlContigsRnas,gbContigsRnas);
  }
 catch (  Exception ex) {
    Logger.getLogger(ControlGenBankFilesQuality.class.getName()).log(Level.SEVERE,null,ex);
    noError=false;
  }
  return noError;
}
 

Example 26

From project BlameSubversion-plugin, under directory /src/main/java/hudson/scm/.

Source file: BlameSubversionSCM.java

  29 
vote

/** 
 * Enables trace logging of Ganymed SSH library. <p> Intended to be invoked from Groovy console.
 */
public static void enableSshDebug(Level level){
  if (level == null)   level=Level.FINEST;
  final Level lv=level;
  com.trilead.ssh2.log.Logger.enabled=true;
  com.trilead.ssh2.log.Logger.logger=new DebugLogger(){
    private final Logger LOGGER=Logger.getLogger(SCPClient.class.getPackage().getName());
    public void log(    int level,    String className,    String message){
      LOGGER.log(lv,className + ' ' + message);
    }
  }
;
}
 

Example 27

From project blog_1, under directory /snippets/.

Source file: AbstractJerseyTest.java

  29 
vote

@BeforeClass public static void initDetailedJerseyLoggingIntoFile() throws Exception {
  String tmpFileDirectory=System.getProperty("java.io.tmpdir");
  File logFile=new File(tmpFileDirectory,"my-jersey-test.log");
  Logger.getLogger("").addHandler(new FileHandler(logFile.getPath()));
  Logger.getLogger("com.sun.jersey").setLevel(Level.FINEST);
  System.out.println(AbstractJerseyTest.class.getSimpleName() + ": Jersey logs in " + logFile);
}
 

Example 28

From project BMach, under directory /src/jsyntaxpane/actions/.

Source file: ActionUtils.java

  29 
vote

/** 
 * Return the lines that span the selection (split as an array of Strings) if there is no selection then current line is returned. Note that the strings returned will not contain the terminating line feeds If the document is empty, then an empty string array is returned.  So you can always iterate over the returned array without a null check The text component will then have the full lines set as selection
 * @param target
 * @return String[] of lines spanning selection / or line containing dot
 */
public static String[] getSelectedLines(JTextComponent target){
  String[] lines=null;
  try {
    PlainDocument pDoc=(PlainDocument)target.getDocument();
    int start=pDoc.getParagraphElement(target.getSelectionStart()).getStartOffset();
    int end;
    if (target.getSelectionStart() == target.getSelectionEnd()) {
      end=pDoc.getParagraphElement(target.getSelectionEnd()).getEndOffset();
    }
 else {
      end=pDoc.getParagraphElement(target.getSelectionEnd() - 1).getEndOffset();
    }
    target.select(start,end);
    lines=pDoc.getText(start,end - start).split("\n");
    target.select(start,end);
  }
 catch (  BadLocationException ex) {
    Logger.getLogger(ActionUtils.class.getName()).log(Level.SEVERE,null,ex);
    lines=EMPTY_STRING_ARRAY;
  }
  return lines;
}
 

Example 29

From project Bukkit-Plugin-Utilties, under directory /src/main/java/de/xzise/.

Source file: XLogger.java

  29 
vote

private XLogger(Logger logger,String pluginName,String version){
  super(logger.getName(),logger.getResourceBundleName());
  this.logger=logger;
  this.pluginName=pluginName;
  this.version=version;
}
 

Example 30

From project Calendar-Application, under directory /calendar/.

Source file: Calindrom.java

  29 
vote

public static void main(String args[]){
  Calindrom app;
  try {
    app=new Calindrom("Calindrom");
    app.setVisible(true);
    app.pack();
  }
 catch (  Exception ex) {
    Logger.getLogger(Calindrom.class.getName()).log(Level.SEVERE,null,ex);
  }
}
 

Example 31

From project capedwarf-green, under directory /connect/src/main/java/org/jboss/capedwarf/connect/server/.

Source file: ServerProxyHandler.java

  29 
vote

/** 
 * Get client.
 * @return the client
 */
private synchronized HttpClient getClient(){
  if (client == null) {
    HttpParams params=createHttpParams();
    HttpProtocolParams.setVersion(params,config.getHttpVersion());
    HttpProtocolParams.setContentCharset(params,config.getContentCharset());
    HttpProtocolParams.setUseExpectContinue(params,config.isExpectContinue());
    HttpConnectionParams.setStaleCheckingEnabled(params,config.isStaleCheckingEnabled());
    HttpConnectionParams.setConnectionTimeout(params,config.getConnectionTimeout());
    HttpConnectionParams.setSoTimeout(params,config.getSoTimeout());
    HttpConnectionParams.setSocketBufferSize(params,config.getSocketBufferSize());
    SchemeRegistry schemeRegistry=createSchemeRegistry();
    ClientConnectionManager ccm=createClientConnectionManager(params,schemeRegistry);
    HttpClient tmp=createClient(ccm,params);
    String username=config.getUsername();
    String password=config.getPassword();
    if (username != null && password != null) {
      if (tmp instanceof AbstractHttpClient) {
        CredentialsProvider credsProvider=AbstractHttpClient.class.cast(tmp).getCredentialsProvider();
        credsProvider.setCredentials(new AuthScope(config.getHostName(),config.getSslPort()),new UsernamePasswordCredentials(username,password));
      }
 else {
        Logger.getLogger(getClass().getName()).warning("Cannot set CredentialsProvider on HttpClient: " + tmp);
      }
    }
    client=tmp;
  }
  return client;
}
 

Example 32

From project CDKHashFingerPrint, under directory /src/benchmark/helper/.

Source file: Base.java

  29 
vote

/** 
 * @param dir
 * @param cutoff 
 * @return
 * @throws FileNotFoundException
 * @throws CDKException
 * @throws IOException  
 */
public static Map<String,IAtomContainer> readMDLMolecules(File dir,int cutoff) throws FileNotFoundException, CDKException, IOException {
  System.out.println("\nReading Files: ");
  Map<String,IAtomContainer> inchiMolMap=new HashMap<String,IAtomContainer>();
  if (dir.isDirectory()) {
    File[] listFiles=dir.listFiles();
    for (    File fileIndex : listFiles) {
      if (fileIndex.isFile() && fileIndex.getName().contains(".mol")) {
        MDLV2000Reader reader=new MDLV2000Reader(new FileReader(fileIndex));
        IAtomContainer ac=(IAtomContainer)reader.read(new AtomContainer());
        try {
          initializeMolecule(ac);
          ac.setID((fileIndex.getName().split(".mol"))[0]);
          String inchiKey=generateInchiKey(ac);
          if (inchiKey == null || ac.getAtomCount() < 3) {
            continue;
          }
          inchiMolMap.put(inchiKey,ac);
        }
 catch (        Exception ex) {
          Logger.getLogger(Base.class.getName()).log(Level.SEVERE,null,ex);
        }
        if ((cutoff - inchiMolMap.size()) == 0) {
          break;
        }
 else {
          System.out.print("\r# " + (cutoff - inchiMolMap.size()));
        }
        reader.close();
      }
    }
  }
  return inchiMolMap;
}
 

Example 33

From project ceylon-runtime, under directory /api/src/main/java/ceylon/modules/api/runtime/.

Source file: AbstractRuntime.java

  29 
vote

protected static void invokeRun(ClassLoader cl,String runClassName,final String[] args) throws Exception {
  final Class<?> runClass;
  try {
    char firstChar=runClassName.charAt(0);
    int lastDot=runClassName.lastIndexOf('.');
    if (lastDot > 0) {
      firstChar=runClassName.charAt(lastDot + 1);
    }
    runClass=cl.loadClass(Character.isLowerCase(firstChar) ? runClassName + "_" : runClassName);
  }
 catch (  ClassNotFoundException ignored) {
    Logger.getLogger("ceylon.runtime").severe("Could not find class or method '" + runClassName + "'");
    return;
  }
  SecurityActions.invokeRun(runClass,args);
}
 

Example 34

From project charts4j, under directory /src/test/java/com/googlecode/charts4j/.

Source file: AbstractAxisChartTest.java

  29 
vote

@Test public void testSetGrid1(){
  final LineChart chart=getBasicChart();
  chart.setGrid(10,10,1,0);
  Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(chart.toURLString());
  String expectedString="http://chart.apis.google.com/chart?chd=e:AAgA..&chg=10.0,10.0,1,0&chs=200x125&cht=lc";
  assertEquals("Junit error",normalize(expectedString),normalize(chart.toURLString()));
}