> Hello, > > We have the following problem: > > > Multiple bundles run on osgi, each of them has a log file. If bundle X calls > bundle Y and a warning occurs in bundle Y, we want to log the warning in the > log file of bundle X. But the problem we have at the moment is that bundle Y > doesn?t know bundle X and how bundle Y knows who have called him. > > We have thought of 3 possible ways to solve the problem: > > 1. StackTrace, but we think it is slow and it?s not nice to use stackt > race. > 2. Set the context in another bundle, so bundle Y can use the function > getlogger to our own created bundle > 3. Security Manager, but we don?t know whether it works well with osgi. > > We want to know which way is the best or maybe someone has the experience > with this problem or knows another solution that we haven?t thought of yet.
To me it seems, like the separation of logfiles is not what you want. What we did in our project, was to create a Logging Service. It is pretty much a wrapper around log4j (or another backend of choice), and the bundle exposes a ServiceFactory which gives every bundle its own logger instance. In the activator of our bundles, the logger is retrieved and the bundle can then use it. So what we have, is the "logging bundle" which writes a single log file, and all bundles of the system can participate by issueing their log statements toward that bundle via the exposed service. > > > Kind regards, > > Laurens bye, Michael The information included in this e-mail and any files transmitted with it is strictly confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately by e-mail and delete this e-mail as well as any attachment from your system. If you are not the intended recipient you are not authorized to use and/or copy this message and/or attachment and/or disclose the contents to any other person.

