我在OpenJPA日志记录方面遇到了一些问题。正如有人建议的那样,我试图将OpenJPA设置为使用log4j,并在persistence.xml中包含以下行:
<property name="openjpa.Log" value="log4j"/>
但它立即打破了openJPA增强过程:
openJPA_enhance.xml:26: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
更新 (Aninda感谢您的帮助)。
在我包含openJpa.jar之后,OpenJPA Enhancer现在无法加载log4j.properties。 我在类路径中包含了Log4j属性和一个jvm参数:“ - Dlog4j.configuration”
我无法通过OpenJPA传递异常:
Buildfile: ../Workspaces_JEE/ETM_Workspace/ETM/openJPA_enhance.xml
openjpa.libs.check:
build.dir.check:
enhance:
[echo] /home/jamad/Workspaces/Workspaces_JEE/ETM/build/classes:/home/jamad/Workspaces/Workspaces_JEE/ETM/src/META-INF/log4j.properties
[openjpac] log4j:WARN No appenders could be found for logger (openjpa.Runtime).
[openjpac] log4j:WARN Please initialize the log4j system properly.
[openjpac] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Unable to obtain resource from /home/jamad/Workspaces/Workspaces_JEE/ETM/src/META-INF/log4j.properties: java.util.zip.ZipException: error in opening zip file
[openjpac] Unable to obtain resource from /home/jamad/Workspaces/Workspaces_JEE/ETM_Workspace/ETM/src/META-INF/log4j.properties:
[openjpac] java.util.zip.ZipException: error in opening zip file
[openjpac] at java.util.zip.ZipFile.open(Native Method)