×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

tomcat 8.0x java.util.logging.Logger.log to file

tomcat 8.0x java.util.logging.Logger.log to file

tomcat 8.0x java.util.logging.Logger.log to file

(OP)
I'm using

CODE -->

private static final java.util.logging.Logger LOGGER = java.util.logging.Logger.getLogger(MyClass.class.getName());
LOGGER.log(Level.INFO, "log message); 
style to log in my java web application.

I start tomcat 8.0.21 from startup.bat (project requirement) on windows 10. I can see all the logging in console window, including java.util.logging.Logger.log logging. But I can't see any java.util.logging.Logger.log logging in tomcat standard log files - %tomcat%/logs/catalina.2018-07-31.log and localhost.2018-07-31.log.

I can see all the tomcat logging, but not my web application logging. I need to track some problems with my web application on client machines in production, because I can't model such problems on my local computer.

I need to see my logging along with other tomcat logging in %tomcat%/logs/catalina.<current_date>.log. It would be better to to use tomcat logging configuration for all the projects. But using a per-project configuration is acceptable too. I have Googled the whole day, but all the recipes I found did not work for me.

Please don't offer to use log4j. Using java.util.logging is a project requirement. Here is my %tomcat%/conf/logging.properties file

CODE -->

handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler

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

.level = INFO

1catalina.org.apache.juli.AsyncFileHandler.level = ALL
1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.

2localhost.org.apache.juli.AsyncFileHandler.level = ALL
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.

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

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

java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = ALL
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler

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

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

mycompany.package1.level = ALL
mycompany.package2.level = ALL
utils.jaxws.level = ALL 

RE: tomcat 8.0x java.util.logging.Logger.log to file

Maybe you need to define the java.util.logging.config.file parameter as said here

Cheers,
Dian

RE: tomcat 8.0x java.util.logging.Logger.log to file

(OP)
java.util.logging.config.file property is used to specify logging properties file to use. In my case tomcat uses ${catalina.base}/conf/logging.properties normally. Tomcat reads configuration from file above. The problem I face is I can't see any console output in tomcat log files.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close