-
1. Re: Enable per-bundle logging across all containers in a Fabric?
iocanel Jan 17, 2013 9:28 AM (in response to komododave)So, in the case of the standalone container you modify the org.ops4j.pax.loggin pid.
In case of fabric you will need to add the modified pid into your profile.
Some commands to do it directly in the default profile:
fabric:profile-edit --import-pid --pid org.ops4j.pax.logging default
fabric:profile-edit --pid org.ops4j.pax.logging default/log4j.rootLogger="INFO, out, sift, osgi:VmLogAppender" default
The first command will import your local configuration into fabric and the second will modify it so that adds sift.
-
2. Re: Enable per-bundle logging across all containers in a Fabric?
komododave Jan 17, 2013 10:26 AM (in response to iocanel)Great answer, thank you iocanel.
-
3. Re: Enable per-bundle logging across all containers in a Fabric?
komododave Jan 17, 2013 11:16 AM (in response to komododave)Just to clarify, I presume you meant to write this:
fabric:profile-edit --pid org.ops4j.pax.logging/log4j.rootLogger="INFO, out, sift, osgi:VmLogAppender" default
There's a stray " default" in what you've written.
-
4. Re: Enable per-bundle logging across all containers in a Fabric?
komododave Jan 23, 2013 5:28 AM (in response to iocanel)After enabling this configuration at time of deployment of our Fabric, we can see that only karaf.log exists under $FABRIC/data/log and $FABRIC/instances/<container-name>/data/log.
We've also tried the same setting but with osgi:*. Sadly this too results in only karaf.log being generated.
We should expect to see many different logs in every Fabric container with this setting applied, correct?
-
5. Re: Enable per-bundle logging across all containers in a Fabric?
iocanel Jan 23, 2013 6:48 AM (in response to komododave)It seems that the org.ops4j.pax.logging pid contains property placeholders for its own use, that should not be resolved by the fabric configuration admin bridge.
Unfortunately, the configuration admin bridge translates the entry:
log4j.appender.sift.appender.file=${karaf.data}/log/$
{bundle.name
}.logto
log4j.appender.sift.appender.file=/path/to/data/folder/log/.log
which result in having all bundle logs merges into the .log file under data/log.
I raised this jira:http://fusesource.com/issues/browse/FABRIC-358
-
6. Re: Enable per-bundle logging across all containers in a Fabric?
komododave Jan 23, 2013 7:17 AM (in response to iocanel)Many thanks for this detailed info, iocanel. We'll keep an eye on the Jira issue status.
-
7. Re: Enable per-bundle logging across all containers in a Fabric?
iocanel Feb 12, 2013 12:09 PM (in response to komododave)A workaround is to escape ${bundle.name} to $
{bundle.name
} inside the profile.You may also want to set or escape things like ${karaf.data} etc.
-
8. Re: Enable per-bundle logging across all containers in a Fabric?
iocanel Feb 13, 2013 10:44 AM (in response to iocanel)An even better solution to the problem is to:
cp etc/org.ops4j.pax.logging.cfg fabric/import/fabric/configs/versions/1.0/profiles/default/org.ops4j.pax.logging.properties
and place there any modifications before creating the fabric. When fabric imports the profiles from the files, it will have everything escaped and will not require you to perform any custom escaping.