468,256 Members | 1,392 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,256 developers. It's quick & easy.

jdk1.4 Logger

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
0 2409

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Gary Johnson | last post: by
reply views Thread by Nicholas Pappas | last post: by
reply views Thread by s | last post: by
reply views Thread by Laszlo | last post: by
1 post views Thread by rameshkumarc | last post: by
1 post views Thread by pushpa13 | last post: by
4 posts views Thread by garyjefferson123 | last post: by
1 post views Thread by Matimus | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.