Bug 435137 - JavaLog: Construction of namespace for session loggers voids any configuration attempt via JUL logging.properties
Summary: JavaLog: Construction of namespace for session loggers voids any configuratio...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 454792
  Show dependency tree
 
Reported: 2014-05-17 14:30 EDT by Reiner Saddey CLA
Modified: 2022-06-09 10:06 EDT (History)
1 user (show)

See Also:


Attachments
Example implementation replacing JavaLog. Might be used to work-around this bug. For demonstration purposes only. (7.46 KB, application/octet-stream)
2014-05-17 14:30 EDT, Reiner Saddey CLA
no flags Details
Amended example implementation replacing JavaLog now supports instant Logging Level Changes vie GlassFish GUI (8.96 KB, text/plain)
2014-05-31 06:45 EDT, Reiner Saddey CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reiner Saddey CLA 2014-05-17 14:30:01 EDT
Created attachment 243211 [details]
Example implementation replacing JavaLog. Might be used to work-around this bug. For demonstration purposes only.

org.eclipse.persistence.logging.JavaLog (activated by means of eclipselink.logging.logger=JavaLogger or defaulted by GlassFish) constructs the namespace for session loggers in a way that makes it virtually impossible to configure logging levels using standard JUL (i.e. logging.properties) or GlassFish approach.

The namespace it constructs for a session logger looks like this:

  org.eclipse.persistence.session.[session name].[category]

Assuming sql statements are to be logged by setting the level for the sql category to FINE

  org.eclipse.persistence.session.sql=FINE 

JavaLog creates a logger namespace similar to
  org.eclipse.persistence.session.file:/var/folders/h9/h10t95696fg82tsqndvg6tdr0000gn/T/gfembed3355794571259202884tmp/applications/6bc88d72-aa1e-497e-94a7-dd0b0ce1b835/WEB-INF/classes/_sef.sql

No chance at all for this namespace to inherit its level from org.eclipse.persistence.session.sql :-(


IMHO, JavaLogger's usability would very much benefit, if namespaces would have sessions names appended last:

  org.eclipse.persistence.session.[category].[session name]

This would enable session loggers to inherit their levels from GlassFish / JUL settings.

I've attached a precarious implementation which implements this pattern (for demonstration purposes only, it requires Java 7 and uses Guava).
Comment 1 Reiner Saddey CLA 2014-05-31 06:45:30 EDT
Created attachment 243748 [details]
Amended example implementation replacing JavaLog now supports instant Logging Level Changes vie GlassFish GUI

There are several code spots saving, changing and eventually restoring SessionLog levels (most probably in order to temporarily disable any logging).

As there is no way to reset a level to "inherit from parent", setting a SessionLog level permanently disables any inheritance from the Java Util Logging levels (e.g. as set using GlassFish GUI).

This new example implementation tries to work-around by interpreting any log level < SEVERE as "remove any level", thus reinstating inheritance from Java Util Logging levels.

Though somewhat quick-and-dirty, EL logging levels set using GlassFish GUI now take effect immediately.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:06:20 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink