openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1557) Logging configuration is difficult for running tests
Date Wed, 10 Mar 2010 16:27:27 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843614#action_12843614
] 

Michael Dick commented on OPENJPA-1557:
---------------------------------------

Good point - that'll also remove the warning messages.. You can still get yourself into trouble
if you use -Dopenjpa.Log=DefaultLevel=FATAL on the maven command line though. System props
won't override the value from config (IIRC) and we'll always pass in loglevel.openjpa on the
config. 

As a quick fix I'd be okay with that though - but it'd be nice to have a single property that
we use throughout the build and 'normal' configuration. 

> Logging configuration is difficult for running tests
> ----------------------------------------------------
>
>                 Key: OPENJPA-1557
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1557
>             Project: OpenJPA
>          Issue Type: Improvement
>    Affects Versions: 1.2.2, 2.0.0-beta2
>            Reporter: Craig L Russell
>            Assignee: Craig L Russell
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1557.diff.txt
>
>
> Logging is difficult to configure and is incorrectly documented for running tests.
> There is a system property that can be set on the command line when running tests using
surefire: openjpa.loglevel. This property, set via -Dopenjpa.loglevel, is used in the pom.xml
to send logging properties to the runtime. The simple case works, e.g. -Dopenjpa.loglevel=error.
This affects enhancement and the test runtime to report only errors. 
> However, setting this property also results in warnings:
> enhance.all.entities:
>      [echo]  running enhancer
> 12  WARN   [main] openjpa.Runtime - The configuration property named "openjpa.loglevel"
was not recognized and will be ignored, although the name closely matches a valid property
called "openjpa.Log".
> 2  WARN   [main] openjpa.Runtime - The configuration property named "openjpa.loglevel"
was not recognized and will be ignored, although the name closely matches a valid property
called "openjpa.Log".
> This is because the property is both passed to the runtime and also used to configure
the log level via the surefire plugin (the relevant part of the pom.xml follows):
>                         <property>
>                             <name>openjpa.Log</name>
>                             <value>DefaultLevel=${openjpa.loglevel}</value>
>                         </property>
> Via "property injection" it's also possible to set any number of other log properties
using this mechanism, although it's a bit odd. Just concatenate the extra properties after
the level. For example,
> mvn test -Dopenjpa.loglevel=trace,file=openjpa.log,Runtime=info
> This will set the default log level to trace, send the log output to the file openjpa.log,
and set the Runtime log level to info.
> The surefire plugin effectively disables the openjpa.Log so the user cannot use this
property.
> The warning can be removed by changing the PersistenceTestCase.createNamedEMF:
>         Map map = new HashMap(System.getProperties());
>         map.remove("openjpa.level");
> But the enhancer doesn't go through this path.
> Before I change the online documentation I'd like to see if anyone else has any ideas
how to make this easier.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message