org.apache.juli.logging.LogFactory Java Examples
The following examples show how to use
org.apache.juli.logging.LogFactory.
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: LoggingBaseTest.java From tomcat-mongo-access-log with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { // Create catalina.base directory tempDir = new File(System.getProperty("tomcat.test.temp", "src/test/java/output")); if (!tempDir.mkdirs() && !tempDir.isDirectory()) { fail("Unable to create temporary directory for test"); } System.setProperty("catalina.base", tempDir.getAbsolutePath()); // Configure logging System.setProperty("java.util.logging.manager", "org.apache.juli.ClassLoaderLogManager"); System.setProperty("java.util.logging.config.file", new File( getBuildDirectory(), "conf/logging.properties").toString()); // Get log instance after logging has been configured log = LogFactory.getLog(getClass()); }
Example #2
Source File: LoggingBaseTest.java From tomcatsrc with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { // Create catalina.base directory tempDir = new File(System.getProperty("tomcat.test.temp", "output/tmp")); if (!tempDir.mkdirs() && !tempDir.isDirectory()) { fail("Unable to create temporary directory for test"); } System.setProperty("catalina.base", tempDir.getAbsolutePath()); // Configure logging System.setProperty("java.util.logging.manager", "org.apache.juli.ClassLoaderLogManager"); System.setProperty("java.util.logging.config.file", new File( getBuildDirectory(), "conf/logging.properties").toString()); // Get log instance after logging has been configured log = LogFactory.getLog(getClass()); log.info("Starting test case [" + testName.getMethodName() + "]"); }
Example #3
Source File: Digester.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * <p> * Provide a hook for lazy configuration of this <code>Digester</code> * instance. The default implementation does nothing, but subclasses * can override as needed. * </p> * * <p> * <strong>Note</strong> This method may be called more than once. * Once only initialization code should be placed in {@link #initialize} * or the code should take responsibility by checking and setting the * {@link #configured} flag. * </p> */ protected void configure() { // Do not configure more than once if (configured) { return; } log = LogFactory.getLog("org.apache.tomcat.util.digester.Digester"); saxLog = LogFactory.getLog("org.apache.tomcat.util.digester.Digester.sax"); // Perform lazy configuration as needed initialize(); // call hook method for subclasses that want to be initialized once only // Nothing else required by default // Set the configuration flag to avoid repeating configured = true; }
Example #4
Source File: LoggingBaseTest.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { // Create catalina.base directory tempDir = new File(System.getProperty("tomcat.test.temp", "output/tmp")); if (!tempDir.mkdirs() && !tempDir.isDirectory()) { fail("Unable to create temporary directory for test"); } System.setProperty("catalina.base", tempDir.getAbsolutePath()); // Configure logging System.setProperty("java.util.logging.manager", "org.apache.juli.ClassLoaderLogManager"); System.setProperty("java.util.logging.config.file", new File( getBuildDirectory(), "conf/logging.properties").toString()); // Get log instance after logging has been configured log = LogFactory.getLog(getClass()); log.info("Starting test case [" + testName.getMethodName() + "]"); }
Example #5
Source File: Digester.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * <p> * Provide a hook for lazy configuration of this <code>Digester</code> * instance. The default implementation does nothing, but subclasses * can override as needed. * </p> * * <p> * <strong>Note</strong> This method may be called more than once. * Once only initialization code should be placed in {@link #initialize} * or the code should take responsibility by checking and setting the * {@link #configured} flag. * </p> */ protected void configure() { // Do not configure more than once if (configured) { return; } log = LogFactory.getLog("org.apache.tomcat.util.digester.Digester"); saxLog = LogFactory.getLog("org.apache.tomcat.util.digester.Digester.sax"); // Perform lazy configuration as needed initialize(); // call hook method for subclasses that want to be initialized once only // Nothing else required by default // Set the configuration flag to avoid repeating configured = true; }
Example #6
Source File: Digester.java From Tomcat8-Source-Read with MIT License | 6 votes |
public static void replaceSystemProperties() { Log log = LogFactory.getLog(Digester.class); if (propertySource != null) { IntrospectionUtils.PropertySource[] propertySources = new IntrospectionUtils.PropertySource[] { propertySource }; Properties properties = System.getProperties(); Set<String> names = properties.stringPropertyNames(); for (String name : names) { String value = System.getProperty(name); if (value != null) { try { String newValue = IntrospectionUtils.replaceProperties(value, null, propertySources, null); if (!value.equals(newValue)) { System.setProperty(name, newValue); } } catch (Exception e) { log.warn(sm.getString("digester.failedToUpdateSystemProperty", name, value), e); } } } } }
Example #7
Source File: TestTldScanner.java From Tomcat8-Source-Read with MIT License | 6 votes |
@Test public void testBug57647() throws Exception { TldScanner scanner = EasyMock.createMock(TldScanner.class); Field f = TldScanner.class.getDeclaredField("log"); f.setAccessible(true); f.set(scanner, LogFactory.getLog(TldScanner.class)); Constructor<TldScanner.TldScannerCallback> constructor = TldScanner.TldScannerCallback.class.getDeclaredConstructor(TldScanner.class); constructor.setAccessible(true); TldScanner.TldScannerCallback callback = constructor.newInstance(scanner); File webappDir = new File("webapps/examples"); Assert.assertFalse(callback.scanFoundNoTLDs()); scan(callback, webappDir, "WEB-INF/lib/taglibs-standard-spec-1.2.5.jar"); Assert.assertTrue(callback.scanFoundNoTLDs()); scan(callback, webappDir, "WEB-INF/lib/taglibs-standard-impl-1.2.5.jar"); Assert.assertTrue(callback.scanFoundNoTLDs()); }
Example #8
Source File: SecurityClassLoad.java From Tomcat8-Source-Read with MIT License | 5 votes |
public static void securityClassLoad(ClassLoader loader) { if (System.getSecurityManager() == null) { return; } final String basePackage = "org.apache.jasper."; try { // Ensure XMLInputFactory is loaded with Tomcat's class loader loader.loadClass(basePackage + "compiler.EncodingDetector"); loader.loadClass(basePackage + "runtime.JspFactoryImpl$PrivilegedGetPageContext"); loader.loadClass(basePackage + "runtime.JspFactoryImpl$PrivilegedReleasePageContext"); loader.loadClass(basePackage + "runtime.JspRuntimeLibrary"); loader.loadClass(basePackage + "runtime.ServletResponseWrapperInclude"); loader.loadClass(basePackage + "runtime.TagHandlerPool"); loader.loadClass(basePackage + "runtime.JspFragmentHelper"); loader.loadClass(basePackage + "runtime.ProtectedFunctionMapper"); loader.loadClass(basePackage + "runtime.PageContextImpl"); loadAnonymousInnerClasses(loader, basePackage + "runtime.PageContextImpl"); loader.loadClass(basePackage + "runtime.JspContextWrapper"); // Trigger loading of class and reading of property SecurityUtil.isPackageProtectionEnabled(); loader.loadClass(basePackage + "servlet.JspServletWrapper"); loadAnonymousInnerClasses(loader, "runtime.JspWriterImpl"); } catch (ClassNotFoundException ex) { Log log = LogFactory.getLog(SecurityClassLoad.class); log.error("SecurityClassLoad", ex); } }
Example #9
Source File: ContainerBase.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * Return the Logger for this Container. */ @Override public Log getLogger() { if (logger != null) return (logger); logger = LogFactory.getLog(logName()); return (logger); }
Example #10
Source File: ContainerBase.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * Return the Logger for this Container. */ @Override public Log getLogger() { if (logger != null) return (logger); logger = LogFactory.getLog(logName()); return (logger); }
Example #11
Source File: WebappClassLoaderBase.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * Clear references. */ protected void clearReferences() { // De-register any remaining JDBC drivers clearReferencesJdbc(); // Stop any threads the web application started clearReferencesThreads(); // Clear any references retained in the serialization caches if (clearReferencesObjectStreamClassCaches) { clearReferencesObjectStreamClassCaches(); } // Check for leaks triggered by ThreadLocals loaded by this class loader if (clearReferencesThreadLocals) { checkThreadLocalsForLeaks(); } // Clear RMI Targets loaded by this class loader if (clearReferencesRmiTargets) { clearReferencesRmiTargets(); } // Clear the IntrospectionUtils cache. IntrospectionUtils.clear(); // Clear the classloader reference in common-logging if (clearReferencesLogFactoryRelease) { org.apache.juli.logging.LogFactory.release(this); } // Clear the classloader reference in the VM's bean introspector java.beans.Introspector.flushCaches(); // Clear any custom URLStreamHandlers TomcatURLStreamHandlerFactory.release(this); }
Example #12
Source File: DigesterFactory.java From Tomcat8-Source-Read with MIT License | 5 votes |
private static String locationFor(String name) { URL location = CLASS_SERVLET_CONTEXT.getResource("resources/" + name); if (location == null && CLASS_JSP_CONTEXT != null) { location = CLASS_JSP_CONTEXT.getResource("resources/" + name); } if (location == null) { Log log = LogFactory.getLog(DigesterFactory.class); log.warn(sm.getString("digesterFactory.missingSchema", name)); return null; } return location.toExternalForm(); }
Example #13
Source File: Digester.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * <p> * Provide a hook for lazy configuration of this <code>Digester</code> * instance. The default implementation does nothing, but subclasses * can override as needed. * </p> * * <p> * <strong>Note</strong> This method may be called more than once. * </p> */ protected void configure() { // Do not configure more than once if (configured) { return; } log = LogFactory.getLog("org.apache.tomcat.util.digester.Digester"); saxLog = LogFactory.getLog("org.apache.tomcat.util.digester.Digester.sax"); // Set the configuration flag to avoid repeating configured = true; }
Example #14
Source File: ContainerBase.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * Return the Logger for this Container. */ @Override public Log getLogger() { if (logger != null) return logger; logger = LogFactory.getLog(getLogName()); return logger; }
Example #15
Source File: ReplicatedMap.java From Tomcat8-Source-Read with MIT License | 5 votes |
private Log getLog() { if (log == null) { synchronized (this) { if (log == null) { log = LogFactory.getLog(ReplicatedMap.class); } } } return log; }
Example #16
Source File: LazyReplicatedMap.java From Tomcat8-Source-Read with MIT License | 5 votes |
private Log getLog() { if (log == null) { synchronized (this) { if (log == null) { log = LogFactory.getLog(LazyReplicatedMap.class); } } } return log; }
Example #17
Source File: RewriteValve.java From Tomcat8-Source-Read with MIT License | 5 votes |
public void setConfiguration(String configuration) throws Exception { if (containerLog == null) { containerLog = LogFactory.getLog(getContainer().getLogName() + ".rewrite"); } maps.clear(); parse(new BufferedReader(new StringReader(configuration))); }
Example #18
Source File: CallbackHandlerImpl.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { String name = null; Principal principal = null; Subject subject = null; String[] groups = null; if (callbacks != null) { // Need to combine data from multiple callbacks so use this to hold // the data // Process the callbacks for (Callback callback : callbacks) { if (callback instanceof CallerPrincipalCallback) { CallerPrincipalCallback cpc = (CallerPrincipalCallback) callback; name = cpc.getName(); principal = cpc.getPrincipal(); subject = cpc.getSubject(); } else if (callback instanceof GroupPrincipalCallback) { GroupPrincipalCallback gpc = (GroupPrincipalCallback) callback; groups = gpc.getGroups(); } else { // This is a singleton so need to get correct Logger for // current TCCL Log log = LogFactory.getLog(CallbackHandlerImpl.class); log.error(sm.getString("callbackHandlerImpl.jaspicCallbackMissing", callback.getClass().getName())); } } // Create the GenericPrincipal Principal gp = getPrincipal(principal, name, groups); if (subject != null && gp != null) { subject.getPrivateCredentials().add(gp); } } }
Example #19
Source File: LoggingBaseTest.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Before public void setUp() throws Exception { log = LogFactory.getLog(getClass()); log.info("Starting test case [" + testName.getMethodName() + "]"); }
Example #20
Source File: TomcatLog.java From uavstack with Apache License 2.0 | 4 votes |
public TomcatLog(String name) { super(name); this.log = LogFactory.getLog(name); Boolean debugcheck = Boolean.valueOf(CatalinaProperties.getProperty("com.creditease.monitor.debug")); this.setDebugable(debugcheck); }
Example #21
Source File: RewriteValve.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Override protected void initInternal() throws LifecycleException { super.initInternal(); containerLog = LogFactory.getLog(getContainer().getLogName() + ".rewrite"); }