I normally use Log4J. I am trying to understand how JULI is configured in the Tomcat server. I have provided my understanding of what these lines mean starting with the character *. Can you please make sure my understanding is correct please.
*THE SET OF ALL HANDLERS HAVE TO BE DECLARED AS VALUES OF handlers
handlers = 1catalina.org.apache.juli.FileHandler,2localhost.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
*THIS IS THE SET OF HANDLERS ALL LOGGERS WILL HAVE THESE HANDLERS like rootLogger IN LOG4J. YOU DO NOT HAVE DECLARE THEM FOR ANY LOGGERS.
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
*THIS IS THE CONFIGURATION FOR ALL THE HANDLERS
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
*[localhost].handlers IS THE SPECIFIC HANDLER FOR LOCALHOST
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler
# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
#org.apache.catalina.startup.ContextConfig.level = FINE
#org.apache.catalina.startup.HostConfig.level = FINE
#org.apache.catalina.session.ManagerBase.level = FINE
#org.apache.catalina.core.AprLifecycleListener.level=FINE
I am confused by this line: .handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
Does every logger get these two loggers even if they have declared their own loggers? So when a message is logged to 2localhost.org.apache.juli.FileHandler it also logged to 1catalina.org.apache.juli.FileHandler and java.util.logging.ConsoleHandler.
Or if a logger has its handlers set, logging will not occur on 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler because its handlers are set.
Any help is welcomed.