Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure Equinox logging? #14

Closed
laeubi opened this issue Jun 1, 2022 · 4 comments
Closed

How to configure Equinox logging? #14

laeubi opened this issue Jun 1, 2022 · 4 comments

Comments

@laeubi
Copy link
Member

laeubi commented Jun 1, 2022

The only option I could found so far is eclipse.log.level or log.threshold mentioned but this configures everything on the global level, but I like to control this on "logger" level (e.g. per bundle), so is there a way using system-properties/config files/ ... or is this a missing feature?

@HannesWell
Copy link
Member

Good question.
If you just want to trace the SCR, maybe this helps:
https://github.com/apache/felix-dev/tree/master/scr#configuration

@laeubi
Copy link
Member Author

laeubi commented Jun 5, 2022

If you just want to trace the SCR, maybe this helps

This will require each and every component to provide custom properties, that's not really useful.

e.g. the slf4j simple logger has the following properties: https://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html that would be useful here is well.

@tjwatson
Copy link
Contributor

tjwatson commented Jun 6, 2022

External configuration of each LoggerContext can be done through the method org.osgi.service.log.admin.LoggerContext.setLogLevels(Map<String, LogLevel>) which can be obtained from the LoggerAdmin service with the org.osgi.service.log.admin.LoggerAdmin.getLoggerContext(String) method.

There is also Configuration Admin which can be used to configure LoggerContext (see https://docs.osgi.org/specification/osgi.core/8.0.0/service.log.html#d0e54441)

We do have built-in configuration property eclipse.log.level (set through config.ini) that can control the LogLevel of the logger named org.eclipse.equinox.logger. This is the logger that writes to the .log file and is the logger used by other logging APIs in Eclipse that end up forwarding their messages to the OSGi Logger. The value can be set to INFO, WARNING and ERROR, INFO will for example show all log message. I'm open to having a more general property that can somehow be used as a default source for configuring other logger names. Although I would probably not recommend trying to shoehorn that into the existing eclipse.log.level configuration property because that one is awkward and predates the whole OSGi LoggerContext API.

@laeubi
Copy link
Member Author

laeubi commented Jun 6, 2022

@tjwatson thanks for the insight, I know this could be done through config admin / logger admin, I'm just more searching for something that is used as defaults if no such configuration exits.

For example I currently investigate if we can include slf4j-osgi but this might produce a lot of log outputs, so people will instantly complain about "logspam", so an easy to use (e.g. adding a property to eclipse.ini) would be good, while telling them to fetch OSGi service and doing something in code will most probably be "to complex" :-)

@laeubi laeubi transferred this issue from eclipse-equinox/equinox.framework Jun 16, 2022
@eclipse-equinox eclipse-equinox locked and limited conversation to collaborators Jun 16, 2022
@laeubi laeubi converted this issue into discussion #20 Jun 16, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants