#1
  1. No Profile Picture
    Source of Wisdom
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Germany, Munich Southside
    Posts
    156
    Rep Power
    19

    Logging soap messages to file with log4j


    Hey folks, got a problem:

    I'm trying to log the soap messages reaching/leaving my server (websphere).

    I'm using log4j and this is my config file (part of it):

    Code:
    log4j.logger.org.apache.axis=DEBUG, WebserviceLogAppender
    log4j.logger.org.apache.axis.TIME=WARN
    
    log4j.appender.WebserviceLogAppender=org.apache.log4j.FileAppender
    log4j.appender.WebserviceLogAppender.File=D:\\WebSphere\\AppServer\\logs\\server1\\webservice.log
    log4j.appender.WebserviceLogAppender.Append=true
    log4j.appender.WebserviceLogAppender.Threshold=DEBUG
    log4j.appender.WebserviceLogAppender.layout=org.apache.log4j.PatternLayout
    log4j.appender.WebserviceLogAppender.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
    as nothing happened I assumed the log-configs within the axis.jar were overwriting my settings so I deleted them within the jar - didn't have any influence so far. the overall log level is debug

    I don't get any logging info, not just no soap messages but nothing at all - all my other logs are running perfect it's just axis

    any idea on this?

    and do you know if debug would be sufficient to get the soap messages (at best together with the envelope but that's not really necessary)
    Everything you own ends up owning you
  2. #2
  3. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,418
    Rep Power
    1713
    I'd start with figuring out why log4j isn't giving you anything. On the command line that starts up WebPhere pass -Dlog4j.debug to turn on log4j debugging. It will print debugging information to the console (stdout a.k.a. System.out)
  4. #3
  5. No Profile Picture
    Source of Wisdom
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Germany, Munich Southside
    Posts
    156
    Rep Power
    19
    tried that - I'm logging the console output to a file but it didn't receive any log4j debug info - could this be set int the log4j.properties as well? if so what would be the line?
    Everything you own ends up owning you
  6. #4
  7. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,418
    Rep Power
    1713
    Are you also specifying -Dlog4j.configuration? I always find that it is far easier to force log4j to use a particular configuration file rather than having it find it on the classpath. I'm not aware of a way to turn on log4j debugging from the config file.
  8. #5
  9. No Profile Picture
    Source of Wisdom
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Germany, Munich Southside
    Posts
    156
    Rep Power
    19
    would that be right then:

    startserver server1 -Dlog4j.configuration=D:\projects\myapp\doc\config\log4j.properties -Dlog4j.debug

    this didn't have any other result... but I'm quite sure anyway that the right log4j.properties is being used as the other logs are working - or is axis maybe using it's own property anyway?
    Everything you own ends up owning you
  10. #6
  11. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,418
    Rep Power
    1713
    I'm afraid I don't know anything about startserver - a batch file I presume?

    Ultimately the -D options must be passed to the Java command. For testing can you make a copy of the startserver file and force those two -D options into the command line? It very well may be doing that already but if you didn't get any log4j debugging then perhaps it isn't passing along the -D's to the Java command.
  12. #7
  13. No Profile Picture
    Source of Wisdom
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Germany, Munich Southside
    Posts
    156
    Rep Power
    19
    ah right it's a batch: this would be the current start parameters (as in the batch)

    "%JAVA_HOME%\bin\java" %WAS_TRACE% %DEBUG% %CONSOLE_ENCODING% "%CLIENTSAS%" "-classpath" "%WAS_CLASSPATH%" "-Dws.ext.dirs=%WAS_EXT_DIRS%" %USER_INSTALL_PROP% "-Dwas.install.root=%WAS_HOME%" "-Dibm.websphere.preload.classes=true" "com.ibm.ws.bootstrap.WSLauncher" "com.ibm.ws.management.tools.WsServerLauncher" "%CONFIG_ROOT%" "%WAS_CELL%" "%WAS_NODE%" %*


    thanks a lot for helping stdunbar! probably I'm just missing some important setting I guess after this I will do that:
    Last edited by MuffinMan; May 10th, 2006 at 03:39 AM.
    Everything you own ends up owning you
  14. #8
  15. No Profile Picture
    Source of Wisdom
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Germany, Munich Southside
    Posts
    156
    Rep Power
    19
    wohooo - I found it: my project directory has an own /libs and in this is an axis.jar - within the jar is a log4j.properties and the settings in there are having an effect - apart from that I got the axis jar as well in my websphere libs it is being used as well but doesn't get the webservice info... why this is like that - I have no idea, anyway I can now try to manipulate the right library
    Everything you own ends up owning you
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0
    Hi
    Logging all SOAP requests/respones can be very usefull in debug or incident managment. But there is hard to read soap messages in console using less/more/cat. I have found OtrosLogViewer on apache license, see video on youtube. It's nice because it can open logs from remote machines (using ssh, sftp or samba/cifs) and have sofisticated search functionlity.

    Krzysztof

IMN logo majestic logo threadwatch logo seochat tools logo