use of alma.acs.logging.config.LogConfig in project ACS by ACS-Community.
the class FrameworkLoggerTest method testDummyFrameworkLogger.
/**
* Other framework loggers did not have the same problem
* as the jacorb logger. Thus this test always passed.
*/
@Test
public void testDummyFrameworkLogger() throws Exception {
LogConfig logConfig = clientLogManager.getLogConfig();
final String expectedFrameworkLoggerName = "myFW@" + FrameworkLoggerTest.class.getSimpleName();
assertThat("Dummy framework logger should NOT be known beforehand.", logConfig.isKnownLogger(expectedFrameworkLoggerName), is(false));
assertThat("Framework logger configuration should be DEBUG, as controlled by ACS_LOG_STDOUT.", AcsLogLevelDefinition.fromXsdLogLevel(logConfig.getNamedLoggerConfig(expectedFrameworkLoggerName).getMinLogLevelLocal()), equalTo(AcsLogLevelDefinition.DEBUG));
// Check if the framework logger is configured in line with the above logConfig results
AcsLogger myFWLogger = ClientLogManager.getAcsLogManager().getLoggerForCorba("myFW", true);
myFWLogger.finer("A framework test log, should be shown.");
assertThat(myFWLogger.isLoggable(AcsLogLevel.TRACE), is(false));
assertThat(myFWLogger.isLoggable(AcsLogLevel.DELOUSE), is(true));
}
use of alma.acs.logging.config.LogConfig in project ACS by ACS-Community.
the class FrameworkLoggerTest method testJacorbLogger.
@Test
public void testJacorbLogger() throws Exception {
LogConfig logConfig = clientLogManager.getLogConfig();
final String expectedJacorbLoggerName = "jacorb@" + FrameworkLoggerTest.class.getSimpleName();
assertThat("jacorb logger should be known already from base class corba calls.", logConfig.isKnownLogger(expectedJacorbLoggerName), is(true));
// JacORB config file "orb.properties" currently contains "jacorb.log.default.verbosity=2" (mapped to INFO),
// but it is not visible as a system property and thus cannot be verified here.
// This test must be started with "-Djacorb.log.default.verbosity=3" (DEBUG) so that we can assert
// the right jacorb log level.
assertThat("Expected system property jacorb.log.default.verbosity=3 set. Check the test start script!", System.getProperty("jacorb.log.default.verbosity"), equalTo("3"));
assertThat("Stdout log level must be DEBUG or lower, to not override the jacorb log level.", logConfig.getDefaultMinLogLevelLocal(), lessThanOrEqualTo(AcsLogLevelDefinition.DEBUG));
assertThat("jacorb logger configuration should be DEBUG for local logging.", AcsLogLevelDefinition.fromXsdLogLevel(logConfig.getNamedLoggerConfig(expectedJacorbLoggerName).getMinLogLevelLocal()), equalTo(AcsLogLevelDefinition.DEBUG));
// Check if the jacorb logger itself is configured according to the above logConfig results
AcsLogger jacorbLogger = ClientLogManager.getAcsLogManager().getLoggerForCorba("jacorb", true);
jacorbLogger.fine("A jacorb test log, should be shown.");
assertThat(jacorbLogger.isLoggable(AcsLogLevel.TRACE), is(false));
assertThat(jacorbLogger.isLoggable(AcsLogLevel.DELOUSE), is(false));
assertThat(jacorbLogger.isLoggable(AcsLogLevel.DEBUG), is(true));
// This setMinLogLevelLocal effects a call to LogConfig#notifySubscribers(),
// which in the past brought out the jacorb logs even when the above "A jacorb test log, should be shown."
// was not logged due a bug.
logConfig.setMinLogLevelLocal(AcsLogLevelDefinition.DELOUSE, "SomeOtherFramework");
jacorbLogger.finer("jacorb test log #2, shown.");
}
use of alma.acs.logging.config.LogConfig in project ACS by ACS-Community.
the class ManagerProxyImpl method get_logger_names.
/**
* Gets the names of all loggers, to allow configuring their levels
* individually. The names are those that appear in the log records in the
* field "SourceObject". This includes the container logger, ORB logger,
* component loggers, and (only C++) GlobalLogger.
*/
public String[] get_logger_names() {
pendingRequests.incrementAndGet();
try {
LogConfig logConfig = ClientLogManager.getAcsLogManager().getLogConfig();
Set<String> loggerNames = logConfig.getLoggerNames();
return loggerNames.toArray(new String[loggerNames.size()]);
} finally {
pendingRequests.decrementAndGet();
}
}
Aggregations