|Can't make per application log file work [message #1767688]
||Sun, 09 July 2017 23:45
| dustContributor dustContributor
Registered: July 2017
I'm trying to use Virgo as a sort of tiny app server to run local periodic Java services, ie, no web sites, no Spring, just plain Java and OSGi stuff.
I've managed to make a bundle and configure it through the configuration manager, which becomes really handy with the hot-reloading of .properties in the pickup folder.
I'm stuck in trying to get per-application log files though. Have in mind that I have no idea about how standard logging is usually done with slf4j, logback, or anything.
From what I've read, to get a per app log file I need a .par. I don't see a way to generate a .par directly from Eclipse, so I just added the expected .par attributes in the MANIFEST.MF (Application name, version, symbolic name and description), and change the exported plugin's file extension from .jar to .par.
That way I get Virgo to create the app folder, and a log file with a few things, but none of the things I'm logging in my bundle.
I've tried to use System.out and System.err, neither gets to the application's log file. And I tried with LoggerFactory.getLogger( clazz ), but that logger isn't writing to the application's log file either.
I have no idea what else I must do to get the bundle to write into the per-application log file. I just wanted some tracing information, ie "mainTask: Starting", "mainTask: Execution failed, retrying", "mainTask: Success", and so on.
If it's relevant, my application has an Activator, that uses a ScheduledThreadPoolExecutor to schedule a periodic task. Both the Activator and the periodic task will be logging some trace information. The activator initializes the scheduler, and registers itself as a ManagedService, when the configuration update method is called, it uses that data to schedule the periodic task. When the bundle is stopped, the activator cancels the pending task and shuts down the scheduler. That's all it does.
Powered by FUDForum
. Page generated in 0.02149 seconds