Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352423

Summary: UnitOfWorkImpl.commitTransactionAfterWritesChanges logs all exceptions as warnings, but some should be finest
Product: z_Archived Reporter: sandra.muller
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: minor    
Priority: P2 CC: tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description sandra.muller CLA 2011-07-19 05:07:47 EDT
Build Identifier: 

In our project we validate data integrity in a preCommit hook. When users of our application validate a business rule, the commit should fail, we give them an error message, and they can correct their mistake and try again. This is implemented by our preCommit hook throwing a subclass of RuntimeException.
UnitOfWorkImpl.commitTransactionAfterWritesChanges catches every RuntimeException, rolls back the transaction (good) and logs the exception as a warning (should not be done). 
This logging of the exception as a warning, causes a log warning message every time a user violates a data integrity rule, which is normal behavior for the application. The warnings unnecessarily clog up the log and give the application administrator the impression that something went wrong, while nothing did go wrong.
What would be best, is if it is configurable which type of exceptions produce a warning (for example an exception that the database is unavailable) and which exceptions should be logged at finest (debug) level (for example data integrity rule violations caused by end user mistakes).

Reproducible: Always

Steps to Reproduce:
1. define a preCommit hook that throws an exception
2. ensure that UnitOfWorkImpl.commitTransactionAfterWritesChanges is called
3. verify that an EclipseLink log message of severity WARN is produced
Comment 1 sandra.muller CLA 2011-07-19 05:09:41 EDT
Workaround: define a custom logger in which you catch log messages of type WARN, check if they have an Exception, and if the type of exception is for a violated data integrity rule, change the log level.
Though I am not sure if all those messages would come from commit time.
Comment 2 Tom Ware CLA 2011-07-22 15:42:32 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:08:57 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink