a logging/trace lib for java

F

frank

I was wondering if anyone had or knew of a basic java class/lib to do
tracing/logging of a java program. All I'm looking to do is have a
utility class I guess to replace plain old System.out.println()(save to
a file probably instead) calls in the code. To be able to turn it on or
off and maybe have different levels of logging also. Seems like this is
something others would also need so I thought I would ask before I tried
to build it myself.


Thanks,

Frank
 
T

TechBookReport

frank said:
I was wondering if anyone had or knew of a basic java class/lib to do
tracing/logging of a java program. All I'm looking to do is have a
utility class I guess to replace plain old System.out.println()(save to
a file probably instead) calls in the code. To be able to turn it on or
off and maybe have different levels of logging also. Seems like this is
something others would also need so I thought I would ask before I tried
to build it myself.


Thanks,

Frank
Two places to look at. The first is the Jakarta Commons Logging project
(http://jakarta.apache.org/commons/logging/). The second is Log4J, also
an apache project (http://logging.apache.org/log4j/docs/).

An even lower tech approach is to point System.out to a file...

HTH
=========================================================================
TechBookReport Java http://www.techbookreport.com/JavaIndex.html
 
V

Vova Reznik

frank said:
I was wondering if anyone had or knew of a basic java class/lib to do
tracing/logging of a java program. All I'm looking to do is have a
utility class I guess to replace plain old System.out.println()(save to
a file probably instead) calls in the code. To be able to turn it on or
off and maybe have different levels of logging also. Seems like this is
something others would also need so I thought I would ask before I tried
to build it myself.


Thanks,

Frank
package java.util.logging
 
R

Roland

I was wondering if anyone had or knew of a basic java class/lib to do
tracing/logging of a java program. All I'm looking to do is have a
utility class I guess to replace plain old System.out.println()(save to
a file probably instead) calls in the code. To be able to turn it on or
off and maybe have different levels of logging also. Seems like this is
something others would also need so I thought I would ask before I tried
to build it myself.


Thanks,

Frank
A third possibility is Java's own logging system (available for Java 1.4
and later)
<http://java.sun.com/j2se/1.5.0/docs/api/java/util/logging/package-summary.html>
<http://java.sun.com/j2se/1.5.0/docs/guide/logging/index.html>
--
Regards,

Roland de Ruiter
` ___ ___
`/__/ w_/ /__/
/ \ /_/ / \
 
R

Roland

log4j is nice too, but you'll need an extra jar :
http://logging.apache.org/log4j/docs/index.html
Yep, it contains implementations for several output destinations, such
as SMTP (email), NT eventlog, Unix syslog.
If only logging to a file is required, Java logging would suffice (log4j
also supports logging to a file, of course).
--
Regards,

Roland de Ruiter
` ___ ___
`/__/ w_/ /__/
/ \ /_/ / \
 
R

Roland

There is a program called "trace" that you can use. It prints out whenever
you enter or leave a method.
Where would I find this program. Do you perhaps have a URL.
--
Regards,

Roland de Ruiter
` ___ ___
`/__/ w_/ /__/
/ \ /_/ / \
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top