• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to configure logging to external file in jax-ws based webservice  RSS feed

 
John Devlon
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've build a jax-ws based web service containing several webmethodes.
I would like to use java.util.logging to log events to a file, using an external properties file.
In the client application, logging works fine.

How do I setup the WS to log to an external text file? Where do I configure the logger?
Do I have to setup the logger with every webmethode call?

The code of my client application


the properties file content



I'm using Glassfish as application server.

I've tried placing the code in a "static" block, but it doesn't work

Does anyone have any idea?

Thanks...
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can initialize your LogManager in HTTP Servlet Context Listener.
So when ever, your application (JAX-WS Web Service) is loaded in Glassfish server, context is loaded and that's where contextInitialized() method is called.

 
John Devlon
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Abhay,

Thanks for your feedback. It works great.

For other people having the same problem, other useful info can be found on ...

http://www.mkyong.com/servlet/what-is-listener-servletcontextlistener-example/

John
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nice to know my suggestion worked
happy learning !!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!