Help using Chainsaw for Log4j

Discussion in 'Java' started by jerry, Jan 14, 2005.

  1. jerry

    jerry Guest

    Newbie questions. Can someone help?

    I'm trying to figure out how to use Chainsaw. I've been using log4j for
    a couple of years, but I'm now trying to figure out how to use Chainsaw
    (V.2). Do you need to have a log4j.properties AND a log4j.xml file ? I
    having trouble distinguishing between receiver files and log4j files.
    Which starts first the application or Chainsaw or does it matter.
    Any quick start information would be appreciated.
    jerry, Jan 14, 2005
    #1
    1. Advertising

  2. jerry

    scott Guest

    Hi Jerry,

    Chainsaw needs a log4j config file (log4j.xml or log4j.properties) to
    configure receivers, similar to how you configure appenders.

    Here's a link to an example receiver configuration:

    http://cvs.apache.org/viewcvs.cgi/l...w/log4j-receiver-sample.xml?rev=1.4&view=auto

    Save this file to somewhere on your file system after modifying the
    'plugin' (receiver) configurations that match the appenders you use (if
    you use a socketappender, configure a socketreceiver to use the same
    port).

    Then, open Chainsaw (available via Web Start here):
    http://logging.apache.org/log4j/docs/chainsaw.html

    >From inside Chainsaw, select the view-show application wide preferences

    menu.

    Specify the URL to the log4j receiver config file you created in the
    'automatic configuration URL' field, hit OK and restart Chainsaw.

    The same receiver configuration example is available from the 'Welcome'
    tab - select the 'View example receiver configuration' button on the
    Welcome tab's toolbar.

    You can also create receivers dynamically from the receiver panel - be
    sure to specify the 'name' field or you you won't be able to find it in
    the receiver list later.

    There is a tutorial available from the Welcome tab explaining the main
    features of Chainsaw.

    If you have more questions feel free to send an email to the log4j user
    mailing list: http://logging.apache.org/site/mailing-lists.html

    Hope this helps,

    Scott

    jerry wrote:
    > Newbie questions. Can someone help?
    >
    > I'm trying to figure out how to use Chainsaw. I've been using log4j

    for
    > a couple of years, but I'm now trying to figure out how to use

    Chainsaw
    > (V.2). Do you need to have a log4j.properties AND a log4j.xml file ?

    I
    > having trouble distinguishing between receiver files and log4j files.
    > Which starts first the application or Chainsaw or does it matter.
    > Any quick start information would be appreciated.
    scott, Jan 15, 2005
    #2
    1. Advertising

  3. jerry

    jerry Guest

    Scott, Thanks for the reply, but I'm still not quite getting it.

    Currently, we are using something like this for Log4J. I've used it
    unsuccessfully with Chainsaw. How does this covert into XML (like the
    example that you provided) ? Thank you.

    log4j.rootCategory=DEBUG, A2, Chainsaw

    log4j.appender.A1=org.apache.log4j.ConsoleAppender
    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    log4j.appender.A1.layout.ConversionPattern=%-5p [%F %L] - %m%n

    log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.A2.file=C:/logs/log4j.log
    log4j.appender.A2.datePattern='.'yyyy-MM-dd
    log4j.appender.A2.append=true
    log4j.appender.A2.layout=org.apache.log4j.PatternLayout
    log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} [%F %L] -
    %m%n

    #log4j.appender.A2=org.apache.log4j.FileAppender
    #log4j.appender.A2.file=C:/logs/log4j.log
    #log4j.appender.A2.layout=org.apache.log4j.xml.XMLLayout
    #log4j.appender.A2.append=false


    #log4j.appender.Chainsaw=org.apache.log4j.net.SocketAppender
    #log4j.appender.Chainsaw.remoteHost=localhost
    #log4j.appender.Chainsaw.port=4445
    #log4j.appender.Chainsaw.locationInfo=true



    scott wrote:
    > Hi Jerry,
    >
    > Chainsaw needs a log4j config file (log4j.xml or log4j.properties) to
    > configure receivers, similar to how you configure appenders.
    >
    > Here's a link to an example receiver configuration:
    >
    >

    http://cvs.apache.org/viewcvs.cgi/l...w/log4j-receiver-sample.xml?rev=1.4&view=auto
    >
    > Save this file to somewhere on your file system after modifying the
    > 'plugin' (receiver) configurations that match the appenders you use

    (if
    > you use a socketappender, configure a socketreceiver to use the same
    > port).
    >
    > Then, open Chainsaw (available via Web Start here):
    > http://logging.apache.org/log4j/docs/chainsaw.html
    >
    > >From inside Chainsaw, select the view-show application wide

    preferences
    > menu.
    >
    > Specify the URL to the log4j receiver config file you created in the
    > 'automatic configuration URL' field, hit OK and restart Chainsaw.
    >
    > The same receiver configuration example is available from the

    'Welcome'
    > tab - select the 'View example receiver configuration' button on the
    > Welcome tab's toolbar.
    >
    > You can also create receivers dynamically from the receiver panel -

    be
    > sure to specify the 'name' field or you you won't be able to find it

    in
    > the receiver list later.
    >
    > There is a tutorial available from the Welcome tab explaining the

    main
    > features of Chainsaw.
    >
    > If you have more questions feel free to send an email to the log4j

    user
    > mailing list: http://logging.apache.org/site/mailing-lists.html
    >
    > Hope this helps,
    >
    > Scott
    >
    > jerry wrote:
    > > Newbie questions. Can someone help?
    > >
    > > I'm trying to figure out how to use Chainsaw. I've been using log4j

    > for
    > > a couple of years, but I'm now trying to figure out how to use

    > Chainsaw
    > > (V.2). Do you need to have a log4j.properties AND a log4j.xml file

    ?
    > I
    > > having trouble distinguishing between receiver files and log4j

    files.
    > > Which starts first the application or Chainsaw or does it matter.
    > > Any quick start information would be appreciated.
    jerry, Feb 23, 2005
    #3
  4. jerry

    Guest

    A couple of things: you can't display location info in Chainsaw V2 if
    you're not using log4j 1.3 (alpha) on the appender side (probably the
    case - if you're using log4j 1.2.9 or earlier).

    Here's what you need to do to your log4j.properties file:
    -uncomment the chainsaw appender section
    -remove this line: log4j.appender.Chainsaw.locationInfo=true

    The sample config file I linked to is set up to receive events on port
    4445 (the SocketReceiver section of the xml file), so the directions I
    listed should work fine.

    - copy the link to the sample receiver config to your file system
    http://cvs.apache.org/viewcvs.cgi/l...w/log4j-receiver-sample.xml?rev=1.4&view=auto

    - save this file to somewhere on your file system
    - open Chainsaw (available via Web Start here):
    http://logging.apache.org/log4j/docs/chainsaw.html

    - from inside Chainsaw, select the view-show application wide
    preferences menu.

    Specify the URL to the log4j receiver config file you created in the
    'automatic configuration URL' field, hit OK and restart Chainsaw.
    The url should look like this:
    file:///c:/mypath/log4j-receiver-sample.xml

    Hope that helps
    Scott


    jerry wrote:
    > Scott, Thanks for the reply, but I'm still not quite getting it.
    >
    > Currently, we are using something like this for Log4J. I've used it
    > unsuccessfully with Chainsaw. How does this covert into XML (like the
    > example that you provided) ? Thank you.
    >
    > log4j.rootCategory=DEBUG, A2, Chainsaw
    >
    > log4j.appender.A1=org.apache.log4j.ConsoleAppender
    > log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    > log4j.appender.A1.layout.ConversionPattern=%-5p [%F %L] - %m%n
    >
    > log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
    > log4j.appender.A2.file=C:/logs/log4j.log
    > log4j.appender.A2.datePattern='.'yyyy-MM-dd
    > log4j.appender.A2.append=true
    > log4j.appender.A2.layout=org.apache.log4j.PatternLayout
    > log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} [%F %L] -
    > %m%n
    >
    > #log4j.appender.A2=org.apache.log4j.FileAppender
    > #log4j.appender.A2.file=C:/logs/log4j.log
    > #log4j.appender.A2.layout=org.apache.log4j.xml.XMLLayout
    > #log4j.appender.A2.append=false
    >
    >
    > #log4j.appender.Chainsaw=org.apache.log4j.net.SocketAppender
    > #log4j.appender.Chainsaw.remoteHost=localhost
    > #log4j.appender.Chainsaw.port=4445
    > #log4j.appender.Chainsaw.locationInfo=true
    >
    >
    >
    > scott wrote:
    > > Hi Jerry,
    > >
    > > Chainsaw needs a log4j config file (log4j.xml or log4j.properties)

    to
    > > configure receivers, similar to how you configure appenders.
    > >
    > > Here's a link to an example receiver configuration:
    > >
    > >

    >

    http://cvs.apache.org/viewcvs.cgi/l...w/log4j-receiver-sample.xml?rev=1.4&view=auto
    > >
    > > Save this file to somewhere on your file system after modifying the
    > > 'plugin' (receiver) configurations that match the appenders you use

    > (if
    > > you use a socketappender, configure a socketreceiver to use the

    same
    > > port).
    > >
    > > Then, open Chainsaw (available via Web Start here):
    > > http://logging.apache.org/log4j/docs/chainsaw.html
    > >
    > > >From inside Chainsaw, select the view-show application wide

    > preferences
    > > menu.
    > >
    > > Specify the URL to the log4j receiver config file you created in

    the
    > > 'automatic configuration URL' field, hit OK and restart Chainsaw.
    > >
    > > The same receiver configuration example is available from the

    > 'Welcome'
    > > tab - select the 'View example receiver configuration' button on

    the
    > > Welcome tab's toolbar.
    > >
    > > You can also create receivers dynamically from the receiver panel -

    > be
    > > sure to specify the 'name' field or you you won't be able to find

    it
    > in
    > > the receiver list later.
    > >
    > > There is a tutorial available from the Welcome tab explaining the

    > main
    > > features of Chainsaw.
    > >
    > > If you have more questions feel free to send an email to the log4j

    > user
    > > mailing list: http://logging.apache.org/site/mailing-lists.html
    > >
    > > Hope this helps,
    > >
    > > Scott
    > >
    > > jerry wrote:
    > > > Newbie questions. Can someone help?
    > > >
    > > > I'm trying to figure out how to use Chainsaw. I've been using

    log4j
    > > for
    > > > a couple of years, but I'm now trying to figure out how to use

    > > Chainsaw
    > > > (V.2). Do you need to have a log4j.properties AND a log4j.xml

    file
    > ?
    > > I
    > > > having trouble distinguishing between receiver files and log4j

    > files.
    > > > Which starts first the application or Chainsaw or does it matter.
    > > > Any quick start information would be appreciated.
    , Feb 23, 2005
    #4
  5. jerry

    vgss

    Joined:
    Sep 12, 2011
    Messages:
    1
    Socket Receiver/Socket Appender

    Hi,


    1. Following is how my SocketAppender configured.


    <appender name="SOCKET1" class="org.apache.log4j.net.SocketAppender">
    <param name="Port" value="12346"/>
    <param name="RemoteHost" value="localhost"/>
    <param name="ReconnectionDelay" value="60000"/>
    <param name="Threshold" value="ALL"/>
    </appender>



    2. Following is how my SocketReceiver is configured.


    <plugin name="MyReceiver1" class="org.apache.log4j.net.SocketReceiver">
    < <param name="Port" value="12346" />
    < <param name="name" value="Server-1" />
    < <param name="Threshold" value="ALL" />
    </plugin>


    By this in chainsaw I am getting a Tabbed Pane with name as “localhost-“, but what I am looking for is a Tabbed Pane with name “localhost-AppName”.

    Please let me know what changes should I do to get, Tabbed Pane name as “localhost-AppName”.
    vgss, Sep 12, 2011
    #5
  6. jerry

    Krzysztof

    Joined:
    May 14, 2012
    Messages:
    3
    Krzysztof, Jun 6, 2012
    #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. scott
    Replies:
    0
    Views:
    717
    scott
    May 24, 2004
  2. Rodolfo
    Replies:
    0
    Views:
    946
    Rodolfo
    Jul 12, 2004
  3. monkey boy via JavaKB.com

    Is there a way to Chainsaw as a service?

    monkey boy via JavaKB.com, Feb 6, 2005, in forum: Java
    Replies:
    0
    Views:
    313
    monkey boy via JavaKB.com
    Feb 6, 2005
  4. iq

    Chainsaw log viewer

    iq, Jun 16, 2005, in forum: Java
    Replies:
    3
    Views:
    697
    Arne Vajhøj
    Sep 19, 2012
  5. tkonrath
    Replies:
    1
    Views:
    3,163
    scott
    Oct 10, 2005
Loading...

Share This Page