By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,032 Members | 811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,032 IT Pros & Developers. It's quick & easy.

jdk1.4 Logger

P: n/a
Hi,

I am using jdk1.4 Logger with a FileHandler for logging in a web
application, and have two questions regarding logging:

The first question is:

I've created an Logger and mapped it to an FileHandler. When the
application starts the logging, The logger is writing in the file as
well as in to Syste.out. How can I turn off system out?

I even tried to delete all other handlers mapped to this logger, and
to map the FileHandler only, but it does not work. Here is my code:

Logger userLogger = Logger.getLogger("");
FileHandler myHandler = new FileHandler("test.log", true);
myHandler.setFormatter(new LogMessageFormatter()); //My own formatter

//Remove all other default handlers from Logger
Handler[] defaultHandlers = userLogger.getHandlers();
for(int i=0; i < defaultHandlers.length; i++){
userLogger.removeHandler(defaultHandlers[i]);
}

userLogger.addHandler(myHandler); //Map file handler to the Logger
The second question:

When the log file is created, I get two files. The LOG file it
self(test.log) and an LOCK file (test.log.lck). Every time I restart
my web application the logger is instantiating an new Log File with an
new sequence number (1,2,3,...) because it does not deletes the old
LOCK file. How can I be shore that the lock file is deleted when I
restart the web application?

Thanks,

N.B.
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.