Unable to change TopLink logging level in GlassFish
In a GlassFish 2.1 environment, I am trying to inc开发者_如何学Pythonrease the logging level for TopLink... to see the raw SQL being generated. In the GlassFish Admin Console, I go to:
Configurations -> my-config -> Logger Settings -> "Log Levels" tab
The logging level for TopLink is determined by the "Persistence" pulldown menu. To dump generated SQL to the logs, you increase the level from "SEVERE" to "FINE" (or greater).
I've done this before on multiple other GlassFish boxes. However, on THIS box the value always reverts back to "SEVERE" after I click the Save button. No error message in the Admin Console, and nothing logged that I can find... the new value simply doesn't stick.
The really confusing thing is that I CAN successfully update the logging level for every other category in the system (e.g. "JMS", "JTA", etc). The problem is specific to the "Persistence" category.
Anyone ever encountered this problem before? Any thoughts would be appreciated.
Odd.
You can always set the log level directly in your JPA persistence.xml,
"toplink.logging.level"="fine"
I eventually confirmed with Oracle that this was a bug in this particular version of GlassFish. Shouldn't be an issue for people who are up to the 3.x generation of GlassFish, and there will eventually be an update for 2.1x.
I have found a workaround for the meantime, though. On that "Log Levels" page, add a new property in the "Additional Properties" section at the bottom. Set the property Name to "oracle.toplink.essentials" (the same package name indicated beside the "Persistence" pulldown), and set the property Value to whatever logging level you want.
Clicking Save will remove this entry from the "Additional Properties" section, but the "Persistence" pulldown will be set to the logging level you had entered.
精彩评论