private StaticLoggerBinder() { defaultLoggerContext.setName(CoreConstants.DEFAULT_CONTEXT_NAME); }
loggerContext.setName(contextName); synchronizedContextMap.put(contextName, loggerContext); URL url = findConfigFileURL(ctx, loggerContext);
private StaticLoggerBinder() { defaultLoggerContext.setName(CoreConstants.DEFAULT_CONTEXT_NAME); }
public Logger configureRootLogger() { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); Logger rootLogger = prepareRootLogger(context); context.setName(executorPid); context.getLogger("ROOT").setLevel(Level.toLevel(BaseRunnerConfiguration.DEFAULT_ROOT_LOG_LEVEL)); context.getLogger("com.hubspot").setLevel(Level.toLevel(BaseRunnerConfiguration.DEFAULT_HUBSPOT_LOG_LEVEL)); for (Map.Entry<String, String> entry : baseConfiguration.getLoggingLevel().entrySet()) { context.getLogger(entry.getKey()).setLevel(Level.toLevel(entry.getValue())); } for (Map.Entry<String, String> entry : primaryConfiguration.getLoggingLevel().entrySet()) { context.getLogger(entry.getKey()).setLevel(Level.toLevel(entry.getValue())); } if (getRootLogPath().isPresent()) { rootLogger.addAppender(buildFileAppender(context, getRootLogPath().get())); } return rootLogger; }
public Logger buildTaskLogger(String taskId, String executorId, String executorPid, String taskLogFile) { LOG.info("Building a task logger for {} pointing to {}", taskId, taskLogFile); LoggerContext context = new LoggerContext(); context.setName(executorPid); baseLogging.prepareRootLogger(context); String loggerId = taskId; try { SingularityTaskId singularityTaskId = SingularityTaskId.valueOf(taskId); loggerId = String.format("%s.%s.%s.%s.%s", singularityTaskId.getRequestId(), singularityTaskId.getDeployId(), singularityTaskId.getStartedAt(), singularityTaskId.getInstanceNo(), executorId); } catch (InvalidSingularityTaskIdException e) { LOG.info("Handling non-SingularityTaskId %s", taskId); } Logger taskLogger = context.getLogger(loggerId); taskLogger.detachAndStopAllAppenders(); if (baseLogging.getRootLogPath().isPresent()) { taskLogger.addAppender(baseLogging.buildFileAppender(context, baseLogging.getRootLogPath().get())); } taskLogger.addAppender(baseLogging.buildFileAppender(context, taskLogFile)); context.start(); return taskLogger; }
loggerContext.setName(contextName); synchronizedContextMap.put(contextName, loggerContext); URL url = findConfigFileURL(ctx, loggerContext);
@Before public void setUp() throws Exception { lc = new LoggerContext(); lc.setName("testContext"); logger = lc.getLogger(LoggerSerializationTest.class); // create the byte output stream bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); whitelist.add(Foo.class.getName()); }
@Before public void setUp() throws Exception { loggerContext = new LoggerContext(); loggerContext.setName("testContext"); logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); // create the byte output stream bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); }
@Before public void setUp() throws Exception { lc = new LoggerContext(); lc.setName("x"); }
@Test public void contextRename() throws JoranException { loggerContext.setName(CoreConstants.DEFAULT_CONTEXT_NAME); configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "contextRename.xml"); assertEquals("wombat", loggerContext.getName()); }
@Before public void setUp() throws Exception { context = new LoggerContext(); context.setName("test"); context.start(); logger = context.getLogger(TurboFilteringInLoggerTest.class); }
@Before public void setUp() throws Exception { lc.setName("test"); sa = new SyslogAppenderFriend(); sa.setContext(lc); }
LoggerContextVO getRandomlyNamedLoggerContextVO() { LoggerContext lc = new LoggerContext(); lc.setName(getRandomJavaIdentifier()); return new LoggerContextVO(lc); }
@Before @Override public void setUp() throws ParseException { lc.setName("test"); super.setUp(); lc.putProperty("randomOutputDir", randomOutputDir); }
@Test public void cnTest() { pl.setPattern("%cn"); lc.setName("aValue"); pl.start(); String val = pl.doLayout(getEventObject()); assertEquals("aValue", val); }
@Test public void contextNameConverter() { ClassicConverter converter = new ContextNameConverter(); // see http://jira.qos.ch/browse/LBCLASSIC-149 LoggerContext lcOther = new LoggerContext(); lcOther.setName("another"); converter.setContext(lcOther); lc.setName("aValue"); ILoggingEvent event = makeLoggingEvent(null); String result = converter.convert(event); assertEquals("aValue", result); }
@Test public void contextNameTest() { pl.setPattern("%contextName"); lc.setName("aValue"); pl.start(); String val = pl.doLayout(getEventObject()); assertEquals("aValue", val); }
@SuppressWarnings("deprecation") @Before public void setUp() { loggerContext.setName("LB139"); BasicConfigurator bc = new BasicConfigurator(); bc.setContext(loggerContext); bc.configure(loggerContext); }
@Before public void setUp() throws Exception { lc = new LoggerContext(); lc.setName("default"); layout = new XMLLayout(); layout.setLocationInfo(true); layout.setContext(lc); layout.setProperties(true); layout.setLocationInfo(true); layout.start(); root = lc.getLogger(Logger.ROOT_LOGGER_NAME); }
@Before public void setUp() throws Exception { lc = new LoggerContext(); lc.setName("default"); layout = new HTMLLayout(); layout.setThrowableRenderer(new DefaultThrowableRenderer()); layout.setContext(lc); layout.setPattern("%level%thread%msg"); layout.start(); root = lc.getLogger(Logger.ROOT_LOGGER_NAME); }