users@glassfish.java.net

Re: Configuring java.util.logging per Web Application in Glassfish

From: <glassfish_at_javadesktop.org>
Date: Thu, 02 Oct 2008 11:28:05 PDT

If you are looking to have logging for specific classes logged to separate files, it can be done. For example, if all of your web application classes begin with "com.acme", you could have these logged to a separate file.

I have built a FileHandlerConfigurator lifecycle module that uses properties such as:

[i]
    <lifecycle-module class-name="com.canoga.glassfish.lifecycle.logging.handler.FileHandlerConfigurator" enabled="true" is-failure-fatal="false" load-order="1" name="FileHandlerConfigurator" object-type="user">
      <description>Logging FileHandler Configurator</description>
      <property name="com.canoga.nms.pcs.slm.pattern" value="slm-%g.log"/>
      <property name="com.canoga.nms.pcs.slm.count" value="10"/>
      <property name="com.canoga.nms.pcs.slm.limit" value="1024000"/>
      <property name="com.canoga.nms.pcs.slm.level" value="FINE"/>
      <property name="com.canoga.nms.pcs.slm.useParentHandlers" value="false"/>
      <property name="com.canoga.nms.pcs.baais.limit" value="1024000"/>
      <property name="com.canoga.nms.pcs.baais.count" value="10"/>
      <property name="com.canoga.nms.pcs.baais.pattern" value="baais-%g.log"/>
      <property name="com.canoga.nms.pcs.baais.level" value="FINE"/>
      <property name="com.canoga.nms.pcs.baais.useParentHandlers" value="false"/>
    </lifecycle-module>
[/i]

Basically you can configure any logger (or parent logger) to use a separate logging file. This uses the same formatter as Glassfish, so you can open these logs up and display and search them with the Admin console log tools.
[Message sent by forum member 'bbergquist' (bbergquist)]

http://forums.java.net/jive/thread.jspa?messageID=303011