org.jboss.logmanager.LogManager Java Examples

The following examples show how to use org.jboss.logmanager.LogManager. 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: Demo.java    From resteasy-examples with Apache License 2.0 6 votes vote down vote up
public static UndertowJaxrsServer buildServer() {
    UndertowJaxrsServer server;
    System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
    try {
        LogManager.getLogManager().readConfiguration(Main.class.getClassLoader().getResourceAsStream("logging.jboss.properties"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    server = new UndertowJaxrsServer().start();

    ResteasyDeployment deployment = new ResteasyDeploymentImpl();

    deployment.setApplicationClass(TracingApp.class.getName());

    DeploymentInfo di = server.undertowDeployment(deployment);
    di.setClassLoader(TracingApp.class.getClassLoader());
    di.setContextPath("");
    di.setDeploymentName("Resteasy");
    di.getServlets().get("ResteasyServlet").addInitParam(ResteasyContextParameters.RESTEASY_TRACING_TYPE, ResteasyContextParameters.RESTEASY_TRACING_TYPE_ALL)
            .addInitParam(ResteasyContextParameters.RESTEASY_TRACING_THRESHOLD, ResteasyContextParameters.RESTEASY_TRACING_LEVEL_VERBOSE);
    server.deploy(di);
    return server;
}
 
Example #2
Source File: SilentModeTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void setupCliLogging() throws Exception {
    File cliLogFile = new File(CLI_LOG_FILE);
    if (cliLogFile.exists()) {
        cliLogFile.delete();
    }

    InputStream is = null;
    try {
        is = getClass().getResourceAsStream(CLI_LOG_CFG);
        LogManager.getLogManager().readConfiguration(is);
    } finally {
        if (is != null) {
            is.close();
        }
    }
}
 
Example #3
Source File: EcsFormatter.java    From ecs-logging-java with Apache License 2.0 5 votes vote down vote up
private String getProperty(final String name, final String defaultValue) {
    String value = LogManager.getLogManager().getProperty(name);
    if (value == null) {
        value = defaultValue;
    } else {
        value = value.trim();
    }
    return value;
}
 
Example #4
Source File: SilentModeTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void tearDownCLiLogging() throws Exception {
    LogManager.getLogManager().reset();
    LogManager.getLogManager().readConfiguration();
}