The moose likes Java in General and the fly likes question about java logging. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "question about java logging." Watch "question about java logging." New topic

question about java logging.

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416

my code as follow:

LogManager lm = LogManager.getLogManager();
Logger logger1 = lm.getLogger("");
Logger logger2 = lm.getLogger("com.mycompany");

and the mylog.properties file as following;

# Logging
handlers = java.util.logging.FileHandler
# File Logging
java.util.logging.FileHandler.pattern = c:/myApp.log
java.util.logging.FileHandler.append = true
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level = INFO
# Console Logging
java.util.logging.ConsoleHandler.level = ALL
com.mycompany.level = ALL

when it is executed, the logger1 is printed as root logger, but the logger2 is null, how can i get logger2 which is configured in the mylog.properties?

Thanks very much...
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37943
Too difficult a question for "beginning". Moving thread.
I agree. Here's the link: http://aspose.com/file-tools
subject: question about java logging.
Similar Threads
[Solved]Hierarchy-wide Threshold Filter Doubt [Log4j]
where does the log4j file go to?
why does java.util.logging.logger create multiple files and locks for mutithreaded pr
Is fileHandler.publish a blocking or non blocking call
Can one set System property programmatically?