0

I have an OSGi application that has the following:

  • It runs on Websphere Liberty
  • It uses the openjpa from websphere liberty via osgi for database access - it does this by importing the necessary javax.persistence packages.
  • It contains a separate bundle for logging which exports the org.slf4j packages

At present the openjpa provided by websphere liberty logs everything to the console output / messages.log file.

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
  • 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
  • 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.
BX21
  • 391
  • 6
  • 19

1 Answers1

1

I answered a very similar question on this topic a month ago [1]. The question was for traditional WebSphere 8.5.5.x, however, the info is pretty much the same for Liberty as well. 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]). 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. Finally, with regard to log wrapping, you can not expect the log file to wrap when using OpenJPA tracing. If you were using container managed entity managers where the container is involved, and in turn WAS tracing, you would get wrapping. However, this wrapping is a WAS feature, not OpenJPA.

[1] WebSphere (8.5.5) does not logging OpenJPA

Community
  • 1
  • 1
  • I see, so as the `openjpa.Log` is not being ignored, I am NOT using container-managed persistence, and so the configuration in server.xml would be ignored. And since openJPA does not support log wrapping by itself, my problem would be getting it to work with log4j somehow in the OSGi application. – BX21 Oct 07 '16 at 09:51