a logging/trace lib for java

Discussion in 'Java' started by frank, Jun 16, 2005.

  1. frank

    frank Guest

    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
     
    frank, Jun 16, 2005
    #1
    1. Advertising

  2. frank wrote:
    > 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
     
    TechBookReport, Jun 16, 2005
    #2
    1. Advertising

  3. frank

    Vova Reznik Guest

    frank wrote:
    > 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
     
    Vova Reznik, Jun 16, 2005
    #3
  4. frank

    Roland Guest

    On 16-6-2005 17:41, frank wrote:

    > 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_/ /__/
    / \ /_/ / \
     
    Roland, Jun 16, 2005
    #4
  5. frank

    Simon OUALID Guest

    Roland wrote:
    > 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>


    log4j is nice too, but you'll need an extra jar :
    http://logging.apache.org/log4j/docs/index.html
     
    Simon OUALID, Jun 16, 2005
    #5
  6. frank

    Roland Guest

    On 16-6-2005 19:34, Simon OUALID wrote:
    > Roland wrote:
    >
    >> 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>

    >
    > 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_/ /__/
    / \ /_/ / \
     
    Roland, Jun 16, 2005
    #6
  7. frank

    Roland Guest

    On 16-6-2005 20:00, Lucy wrote:

    > "Roland" <> wrote in message
    > news:42b1a647$0$10053$4all.nl...
    >
    >>On 16-6-2005 17:41, frank wrote:
    >>
    >>
    >>>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.
    >>>

    >
    > 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_/ /__/
    / \ /_/ / \
     
    Roland, Jun 16, 2005
    #7
  8. frank

    Lucy Guest

    "Roland" <> wrote in message
    news:42b1d115$0$10424$4all.nl...
    > On 16-6-2005 20:00, Lucy wrote:
    >
    > > "Roland" <> wrote in message
    > > news:42b1a647$0$10053$4all.nl...
    > >
    > >>On 16-6-2005 17:41, frank wrote:
    > >>
    > >>
    > >>>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.
    > >>>

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


    www.jmonde.org
    but when you click on it, it goes immedately to
    http://www.geocities.com/mcphailmj/

    On-the-fly runtime method tracing for Java applications

    Synopsis
    org.jmonde.debug.Trace [ options ] class [ argument ... ]
     
    Lucy, Jun 17, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rukmal Fernando
    Replies:
    4
    Views:
    862
    Richard Grimes [MVP]
    Oct 27, 2003
  2. Matthias S.
    Replies:
    1
    Views:
    666
    Daniel Fisher\(lennybacon\)
    Nov 30, 2005
  3. Jiho Han
    Replies:
    0
    Views:
    531
    Jiho Han
    Aug 22, 2006
  4. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    Adding my messages to the trace.axd trace?

    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Apr 6, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    602
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=
    Apr 6, 2007
  5. Chris Newby
    Replies:
    0
    Views:
    774
    Chris Newby
    Jul 28, 2008
Loading...

Share This Page