Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have Tomcat 6 installed as a Windows service. All log messages from my web application dreambear (logged with getServletContext().log()) are going to the stdout log instead of the log file I specified. This happened even before I added the dreambear logger, when the messages should still have gotten to the localhost log instead stdout.

Below are the contents of logging.properties. The specified log files are created, though empty, so there probably isn't a syntax error or something like that in this file.

handlers = \
    1catalina.org.apache.juli.FileHandler, \
    2localhost.org.apache.juli.FileHandler, \
    3manager.org.apache.juli.FileHandler, \
    4host-manager.org.apache.juli.FileHandler, \
    5dreambear.org.apache.juli.FileHandler, \
    java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

############################################################
# 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.

3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.

4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.

5dreambear.org.apache.juli.FileHandler.level = FINE
5dreambear.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5dreambear.org.apache.juli.FileHandler.prefix = dreambear.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/dreambear].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/dreambear].handlers = 5dreambear.org.apache.juli.FileHandler

Or should I just use Log4J?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Is dreambear the name of the web application? Or the servlet?

In these 2 lines,

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/dreambear].level = INFO 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/dreambear].handlers = 5dreambear.org.apache.juli.FileHandler

It needs to be the name of the web application in [/dreambear] and not that of the servlet. Then your logging will work.

also try changing logging level to ALL here

5dreambear.org.apache.juli.FileHandler.level = ALL 
share|improve this answer
    
Yes, it's the name of my web app. It has only one servlet, therefore the confusion. –  Bart van Heukelom Oct 15 '10 at 8:36
    
@Bart van Heukelom : Okay then try asking on stackoverflow for a better response –  JoseK Oct 15 '10 at 10:50
    
Ok I'll try that. I already have another Tomcat related question there: stackoverflow.com/questions/3942655/… –  Bart van Heukelom Oct 15 '10 at 13:30
    
Yes, saw that. I meant log4j stuff is better answered on SO, so you'd get a better recommendation. –  JoseK Oct 18 '10 at 8:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.