Log4J SocketAppender in HOSTCONFIG

Hi;

I would like to monitor the logging output from Mediator using chainsaw via the log4j SocketAppender.
I can’t seem to get the settings right in Mediator’s configuration (hostconfig.xml) - does anyone have a working sample?

regards,
L

Hi Lech,

To use Chainsaw with its default settings, modify the Mediator’s hostconfig.xml as follows: (be sure to keep a backup copy of the file!)

  1. Locate the element with element equal to “log4j.category.xbd” and change the corresponding element from “xbdLog” to xbdLog,chainsaw"

  2. After the last element inside the element, insert the following elements:

    log4j.appender.chainsaw
    org.apache.log4j.net.SocketAppender
    string


    log4j.appender.chainsaw.locationInfo
    true
    string


    log4j.appender.chainsaw.port
    4445
    string


    log4j.appender.chainsaw.remoteHost
    localhost
    string

  3. Save the modified hostconfig.xml.

  4. Start chainsaw (optional)

  5. Start or restart your Mediator HostManager and ComponentFactories.

You do not have to start chainsaw first, but if it is not active when the log4j appender tries to connect, it is something like 30 seconds before it will try to connect again.

Also, you will have to change the log4j.appender.chainsaw.remoteHost value if you want to run chainsaw on a different machine.

Last, be aware that this additional logging will have a performance impact on Mediator.

Thanks Mike;

that was the solution.

I am now wondering - will it be possible to enable chainsaw logging per Component Factory? There is a section within each Component Factory config for logging parameters - I will try there.

Also - will it be possible in the future to dynamically add chainsaw remote hosts to a running Component Factory / Host Manager? right now, you need to stop the host manager, add the entries and start the host manager.

Are there any measure as to how much of a performance hit these socket appenders are?

regards,

L

Hello Lech,

Currently it is not possible to establish separate log4j configurations for each CF, beyond some things like filename, size, backup index and log level.

I have no specific information about the performance impact of SocketAppender. This will depend on the log level, the size of the messages, and the speed of the network connection. It is certain, however, that adding an additional log4j appender is not “free”.