Java Code Examples for java.util.logging.Level#ALL

The following examples show how to use java.util.logging.Level#ALL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GitAPITestCase.java    From git-client-plugin with MIT License 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
    revParseBranchName = null;
    setTimeoutVisibleInCurrentTest(true);
    checkoutTimeout = -1;
    cloneTimeout = -1;
    fetchTimeout = -1;
    submoduleUpdateTimeout = -1;
    Logger logger = Logger.getLogger(this.getClass().getPackage().getName() + "-" + logCount++);
    handler = new LogHandler();
    handler.setLevel(Level.ALL);
    logger.setUseParentHandlers(false);
    logger.addHandler(handler);
    logger.setLevel(Level.ALL);
    listener = new hudson.util.LogTaskListener(logger, Level.ALL);
    listener.getLogger().println(LOGGING_STARTED);
    w = new WorkingArea();
}
 
Example 2
Source File: JavaUtilLoggerImpl.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private static Level toJavaUtilLevel( int chartLevel )
{
	if ( chartLevel <= ILogger.ALL )
	{
		return Level.ALL;
	}
	if ( chartLevel <= ILogger.TRACE )
	{
		return Level.FINER;
	}
	if ( chartLevel <= ILogger.INFORMATION )
	{
		return Level.INFO;
	}
	if ( chartLevel <= ILogger.WARNING )
	{
		return Level.WARNING;
	}

	// Default to SEVERE.
	return Level.SEVERE;
}
 
Example 3
Source File: MemcacheCommonServiceTest.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
@Test
public void testErrorHandler() {
    ConsistentLogAndContinueErrorHandler handler = new ConsistentLogAndContinueErrorHandler(Level.ALL);
    ConsistentLogAndContinueErrorHandler returned = initConsistentErrorHandler(memcache, handler);

    ConsistentLogAndContinueErrorHandler asyncHandler = new ConsistentLogAndContinueErrorHandler(Level.ALL);
    ConsistentLogAndContinueErrorHandler asyncReturned = initConsistentErrorHandler(asyncMemcache, asyncHandler);

    assertTrue(handler.equals(returned));
    assertTrue(asyncHandler.equals(asyncReturned));

    int recordSize = (1024 * 1024) * 2;  // 2MB which should fail.
    byte[] filledRec = new byte[recordSize];
    Arrays.fill(filledRec, (byte) 0x41);

    // MemcacheServiceException should not surface to the test.
    memcache.put("BiggerThanOneMBValue", filledRec);
    asyncMemcache.put("BiggerThanOneMBValue", filledRec);
}
 
Example 4
Source File: PLogger.java    From uavstack with Apache License 2.0 5 votes vote down vote up
private static Level getLevel(LogLevel level) {

        Level l = Level.INFO;
        switch (level) {
            case ALL:
                l = Level.ALL;
                break;
            case DEBUG:
                l = Level.FINEST;
                break;
            case ERR:
                l = Level.SEVERE;
                break;
            case FINE:
                l = Level.FINE;
                break;
            case FINER:
                l = Level.FINER;
                break;
            case INFO:
                l = Level.INFO;
                break;
            case WARNING:
                l = Level.WARNING;
                break;
            default:
                l = Level.INFO;
                break;
        }
        return l;
    }
 
Example 5
Source File: GitClientCloneTest.java    From git-client-plugin with MIT License 5 votes vote down vote up
@Before
public void setUpRepositories() throws Exception {
    Logger logger = Logger.getLogger(this.getClass().getPackage().getName() + "-" + logCount++);
    handler = new LogHandler();
    handler.setLevel(Level.ALL);
    logger.setUseParentHandlers(false);
    logger.addHandler(handler);
    logger.setLevel(Level.ALL);
    listener = new hudson.util.LogTaskListener(logger, Level.ALL);

    workspace = new WorkspaceWithRepo(repo.getRoot(), gitImplName, listener);
    testGitClient = workspace.getGitClient();
    testGitDir = workspace.getGitFileDir();
}
 
Example 6
Source File: JavaServer.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Level getLogLevel(JSONObject query) {
    JSONObject prefs;
    if (query.has("requiredCapabilities") && query.getJSONObject("requiredCapabilities").has("loggingPrefs")) {
        prefs = query.getJSONObject("requiredCapabilities").getJSONObject("loggingPrefs");
    } else if (query.has("desiredCapabilities") && query.getJSONObject("desiredCapabilities").has("loggingPrefs")) {
        prefs = query.getJSONObject("desiredCapabilities").getJSONObject("loggingPrefs");
    } else {
        return Level.ALL;
    }
    if (prefs.has("driver")) {
        return Level.parse(prefs.getString("driver"));
    }
    return Level.ALL;
}
 
Example 7
Source File: IssueTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 8
Source File: IssueTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 9
Source File: NbClipboardNativeTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected Level logLevel() {
    return Level.ALL;
}
 
Example 10
Source File: QueryRefreshTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 11
Source File: InitialConfigurator.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Level getLevelOf(final String loggerName) {
    return loggerName.isEmpty() ? Level.ALL : null;
}
 
Example 12
Source File: RepositoryControllerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 13
Source File: GitCloneReadSaveRequest.java    From blueocean-plugin with MIT License 4 votes vote down vote up
GitClient cloneRepo() throws InterruptedException, IOException {
    EnvVars environment = new EnvVars();
    TaskListener taskListener = new LogTaskListener(Logger.getAnonymousLogger(), Level.ALL);
    String gitExe = gitTool.getGitExe();
    GitClient git = Git.with(taskListener, environment)
            .in(repositoryPath)
            .using(gitExe)
            .getClient();

    git.addCredentials(gitSource.getRemote(), getCredential());

    try {
        git.clone(gitSource.getRemote(), "origin", true, null);

        log.fine("Repository " + gitSource.getRemote() + " cloned to: " + repositoryPath.getCanonicalPath());
    } catch(GitException e) {
        // check if this is an empty repository
        boolean isEmptyRepo = false;
        try {
            if (git.getRemoteReferences(gitSource.getRemote(), null, true, false).isEmpty()) {
                isEmptyRepo = true;
            }
        } catch(GitException ge) {
            // *sigh* @ this necessary hack; {@link org.jenkinsci.plugins.gitclient.CliGitAPIImpl#getRemoteReferences}
            if ("unexpected ls-remote output ".equals(ge.getMessage())) { // blank line, command succeeded
                isEmptyRepo = true;
            }
            // ignore other reasons
        }

        if(isEmptyRepo) {
            git.init();
            git.addRemoteUrl("origin", gitSource.getRemote());

            log.fine("Repository " + gitSource.getRemote() + " not found, created new to: " + repositoryPath.getCanonicalPath());
        } else {
            throw e;
        }
    }

    return git;
}
 
Example 14
Source File: SvnHookTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 15
Source File: RepositoryTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 16
Source File: LazyNodeTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 17
Source File: OpenIssueTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 18
Source File: QueryTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.ALL;
}
 
Example 19
Source File: UtilDetailsProvider.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private DetailsLogRecord(Instance rec, Heap h) {
    super(Level.ALL, null);
    record = rec;
    heap = h;
}
 
Example 20
Source File: ClientSharedUtils.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public static void initLog4J(String logFile,
    Level level) throws IOException {
  // set the log file location
  Properties props = new Properties();
  InputStream in = ClientSharedUtils.class.getResourceAsStream(
      "/store-log4j.properties");
  try {
    props.load(in);
  } finally {
    in.close();
  }

  // override file location and level
  if (level != null) {
    String levelStr = "INFO";
    // convert to log4j level
    if (level == Level.SEVERE) {
      levelStr = "ERROR";
    } else if (level == Level.WARNING) {
      levelStr = "WARN";
    } else if (level == Level.INFO || level == Level.CONFIG) {
      levelStr = "INFO";
    } else if (level == Level.FINE || level == Level.FINER ||
        level == Level.FINEST) {
      levelStr = "TRACE";
    } else if (level == Level.ALL) {
      levelStr = "DEBUG";
    } else if (level == Level.OFF) {
      levelStr = "OFF";
    }
    if (logFile != null) {
      props.setProperty("log4j.rootCategory", levelStr + ", file");
    } else {
      props.setProperty("log4j.rootCategory", levelStr + ", console");
    }
  }
  if (logFile != null) {
    props.setProperty("log4j.appender.file.file", logFile);
  }
  // lastly override with any user provided properties file
  in = ClientSharedUtils.class.getResourceAsStream("/log4j.properties");
  if (in != null) {
    Properties setProps = new Properties();
    try {
      setProps.load(in);
    } finally {
      in.close();
    }
    props.putAll(setProps);
  }
  LogManager.resetConfiguration();
  PropertyConfigurator.configure(props);
}