The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
Logging soap messages to file with log4j
Discuss Logging soap messages to file with log4j in the Java Help forum on Dev Shed. Logging soap messages to file with log4j Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

May 9th, 2006, 10:18 AM
|
|
Source of Wisdom
|
|
Join Date: Sep 2003
Location: Germany, Munich Southside
|
|
|
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
|

May 9th, 2006, 10:36 AM
|
 |
Contributing User
|
|
Join Date: May 2004
Location: Superior, CO, USA
|
|
|
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)
__________________
Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums.
|

May 9th, 2006, 11:02 AM
|
|
Source of Wisdom
|
|
Join Date: Sep 2003
Location: Germany, Munich Southside
|
|
|
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?
|

May 9th, 2006, 11:13 AM
|
 |
Contributing User
|
|
Join Date: May 2004
Location: Superior, CO, USA
|
|
|
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.
|

May 9th, 2006, 11:21 AM
|
|
Source of Wisdom
|
|
Join Date: Sep 2003
Location: Germany, Munich Southside
|
|
|
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?
|

May 9th, 2006, 11:40 AM
|
 |
Contributing User
|
|
Join Date: May 2004
Location: Superior, CO, USA
|
|
|
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.
|

May 10th, 2006, 03:37 AM
|
|
Source of Wisdom
|
|
Join Date: Sep 2003
Location: Germany, Munich Southside
|
|
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.
|

May 10th, 2006, 04:13 AM
|
|
Source of Wisdom
|
|
Join Date: Sep 2003
Location: Germany, Munich Southside
|
|
|
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
|

January 24th, 2013, 04:48 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 1
Time spent in forums: 8 m 12 sec
Reputation 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
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|