简体   繁体   English

OpenJPA登录Websphere自由osgi

[英]openjpa logging in websphere liberty osgi

I have an OSGi application that has the following: 我有一个具有以下内容的OSGi应用程序:

  • It runs on Websphere Liberty 它在Websphere Liberty上运行
  • It uses the openjpa from websphere liberty via osgi for database access - it does this by importing the necessary javax.persistence packages. 它通过osgi使用来自websphere liberty的openjpa进行数据库访问-通过导入必要的javax.persistence包来实现。
  • It contains a separate bundle for logging which exports the org.slf4j packages 它包含一个单独的日志包,用于导出org.slf4j软件包

At present the openjpa provided by websphere liberty logs everything to the console output / messages.log file. 目前,websphere liberty提供的openjpa将所有内容记录到控制台输出/messages.log文件中。

I would like to configure this behaviour and specify a different file / make it use the logging bundle. 我想配置此行为并指定其他文件/使其使用日志记录包。

Things I have tried : 我尝试过的事情:

  • Provide a element in the server.xml - this is ignored 在server.xml中提供一个元素-这将被忽略
  • Specify "File=filename" option in the openjpa.Log property - this results in a file that does not rollover, which means its size grows without limit 在openjpa.Log属性中指定“ File = filename”选项-这将导致文件不翻转,这意味着其大小会无限增加
  • Try to create my own Logging implementation in an application bundle and provide that - this results in class not found errors as the openjpa bundle inside liberty cannot find my logging class. 尝试在应用程序捆绑包中创建我自己的Logging实现,并提供它-导致类未找到错误,因为libty中的openjpa捆绑包找不到我的日志记录类。

I answered a very similar question on this topic a month ago [1]. 一个月前,我就这个话题回答了一个非常类似的问题[1]。 The question was for traditional WebSphere 8.5.5.x, however, the info is pretty much the same for Liberty as well. 问题是传统的WebSphere 8.5.5.x,但是,Liberty的信息也几乎相同。 Please read that link and if you still have questions please ask specifics. 请阅读该链接,如果仍有疑问,请询问具体信息。 Let me add a few specifics to your comments: As far as any OpenJPA trace settings being ignored in server.xml, I'd expect them to be ignored by WAS tracing when a user is not using container managed entity managers (I explain why in [1]). 让我在您的评论中添加一些细节:至于在server.xml中忽略的任何OpenJPA跟踪设置,我希望当用户不使用容器管理的实体管理器时,WAS跟踪会忽略它们。 [1])。 In this case, you'd need to put the trace properties in your persistence.xml file, or you can specify them as a JVM property. 在这种情况下,您需要将跟踪属性放在persistence.xml文件中,或者可以将其指定为JVM属性。 Finally, with regard to log wrapping, you can not expect the log file to wrap when using OpenJPA tracing. 最后,关于日志包装,在使用OpenJPA跟踪时,不能指望日志文件包装。 If you were using container managed entity managers where the container is involved, and in turn WAS tracing, you would get wrapping. 如果您使用涉及容器的容器管理实体管理器,然后使用WAS跟踪,则会得到包装。 However, this wrapping is a WAS feature, not OpenJPA. 但是,此包装是WAS功能,而不是OpenJPA。

[1] WebSphere (8.5.5) does not logging OpenJPA [1] WebSphere(8.5.5)不记录OpenJPA

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM