Axis logging: howto setup?

Discussion in 'Java' started by cyberco, Mar 13, 2007.

  1. cyberco

    cyberco Guest

    I'm developing a simple web service using Apache, Tomcat 5, Axis 1.4

    Instead of using System.out.println I'm trying to setup logging for
    Axis. Unfortunately this is more complex than I expected. Basically,
    for starters, I want to have the logging output go to the console (or
    to a file). I've tried to use the java.util.logging package for this:

    ===========================================
    import java.util.logging.Logger;
    Logger logger = Logger.getLogger("MyLogger");
    logger.addHandler(new ConsoleHandler());
    logger.setLevel(java.util.logging.Level.FINEST);
    logger.info("hello");
    ===========================================

    This doesn't work.
    What is the simplest way to setup logging in Axis? Am I on the right
    track or should I use configuration files or so?

    2B
    cyberco, Mar 13, 2007
    #1
    1. Advertising

  2. cyberco

    cyberco Guest

    I'm still struggling with this. Anybody here that has any experience
    with Axis and logging (or knows where I can post this question as
    well)?

    2B
    cyberco, Mar 18, 2007
    #2
    1. Advertising

  3. cyberco wrote:
    > I'm developing a simple web service using Apache, Tomcat 5, Axis 1.4
    >
    > Instead of using System.out.println I'm trying to setup logging for
    > Axis. Unfortunately this is more complex than I expected. Basically,
    > for starters, I want to have the logging output go to the console (or
    > to a file). I've tried to use the java.util.logging package for this:
    >
    > ===========================================
    > import java.util.logging.Logger;
    > Logger logger = Logger.getLogger("MyLogger");
    > logger.addHandler(new ConsoleHandler());
    > logger.setLevel(java.util.logging.Level.FINEST);
    > logger.info("hello");
    > ===========================================
    >
    > This doesn't work.
    > What is the simplest way to setup logging in Axis? Am I on the right
    > track or should I use configuration files or so?


    It actually works for me with Tomcat 5.5 + Axis 1.4 !

    import java.util.logging.*;

    public class Dummy {
    static {
    Logger logger = Logger.getLogger("Dummy");
    logger.addHandler(new ConsoleHandler());
    logger.setLevel(Level.FINEST);
    }
    public void dummy() {
    System.out.println("println OK");
    Logger logger = Logger.getLogger("Dummy");
    logger.info("java util logging OK");
    }
    }

    console output:

    println OK
    2007-03-18 20:55:35 Dummy dummy
    INFO: java util logging OK
    2007-03-18 20:55:35 Dummy dummy
    INFO: java util logging OK

    (the log4j output is double because there already were a console
    handler before I added a second)

    Arne
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Mar 19, 2007
    #3
  4. cyberco

    cyberco Guest

    Hmm...OK.
    I expect the output to appear in Tomcat's 'catalina.out' logging file,
    is that where you see your output?
    cyberco, Mar 19, 2007
    #4
  5. cyberco wrote:
    > Hmm...OK.
    > I expect the output to appear in Tomcat's 'catalina.out' logging file,
    > is that where you see your output?


    The way I run Tomcat I have a real console windows where I see it.

    Arne
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Mar 20, 2007
    #5
  6. Arne Vajhøj <> writes:

    > cyberco wrote:
    >> Hmm...OK.
    >> I expect the output to appear in Tomcat's 'catalina.out' logging file,
    >> is that where you see your output?

    >
    > The way I run Tomcat I have a real console windows where I see it.
    >


    Those should be the same; catalina.sh will redirect
    stdout and stderr to catalina.out if (and only if) you
    ask it to start Tomcat as a background process.

    --
    Mark Jeffcoat
    Austin, TX
    Mark Jeffcoat, Mar 20, 2007
    #6
    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. Joey Vendetta
    Replies:
    0
    Views:
    3,433
    Joey Vendetta
    Apr 1, 2004
  2. Stefan
    Replies:
    0
    Views:
    721
    Stefan
    May 6, 2004
  3. Replies:
    0
    Views:
    900
  4. hocho888
    Replies:
    1
    Views:
    611
  5. ed
    Replies:
    2
    Views:
    416
    Mike Schilling
    Dec 8, 2006
Loading...

Share This Page