Skip to content
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

Logger in BEF is not working after initial Bazel builds start #10

Closed
plaird opened this issue Nov 21, 2019 · 3 comments · Fixed by #339
Closed

Logger in BEF is not working after initial Bazel builds start #10

plaird opened this issue Nov 21, 2019 · 3 comments · Fixed by #339
Labels
1.5.0 BEF 1.5.0 BEF Bazel Eclipse bug Something isn't working

Comments

@plaird
Copy link
Contributor

plaird commented Nov 21, 2019

This started as a logback issue, but now it is something different. I think what is happening is once we start invoking Bazel commands, and hook stdout and stderr for that, our logging to outer Eclipse no longer works.

====

We revamped the logging for the feature. But on my machine, file logging is not working correctly. I tried a bunch of different things, but in the end I found a clue that suggests a load ordering problem.

I have added this check to our Eclipse logging facade:

bazel-eclipse/plugin-core/src/main/java/com/salesforce/bazel/eclipse/EclipseLoggerFacade.java#L153

And it indicates the logback is indeed in the classpath, but for some reason my log factory was initialized too early or in a different plugin such that logback was not found:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

com.salesforce.bazel.eclipse.core: EclipseLoggerFacade could not configure file (INFO, DEBUG) logging. LoggerFactory is of type [class org.slf4j.helpers.NOPLoggerFactory] but needed [ch.qos.logback.classic.LoggerContext] to configure the file log. The class ch.qos.logback.classic.LoggerContext is NOW available in the classpath, which means there was a startup loading issue. The class wasn't there when logging was initialized. See bazel-eclipse/docs/dev/logging.md for more details.

@plaird
Copy link
Contributor Author

plaird commented Dec 5, 2019

I am also seeing this error on startup from the Gradle plugin only when the BEF is installed:

An internal error occurred during: "Loading available Gradle versions".
Class ch.qos.logback.classic.LoggerContext does not implement the requested interface org.slf4j.ILoggerFactory

@plaird
Copy link
Contributor Author

plaird commented Dec 18, 2019

I suspect these issues happen when M2Eclipse is also installed. I see this at startup in my Eclipse that is affected when BEF is not installed:

org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized. Will retry after the state location is initialized.
org.eclipse.m2e.logback.configuration: Logback config file: /Users/plaird/eclipse-workspace-2018-09b/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.9.1.20180912-1601.xml
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://517.fwk1850777594:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://517.fwk1850777594:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
org.eclipse.m2e.logback.configuration: Initializing logback

I have ripped out all external logging libs from BEF for the short term until we have time to investigate.
0da5faf

@plaird plaird added the bug Something isn't working label Dec 20, 2019
@plaird plaird changed the title Logback is not loaded early enough to be used as the logger in the Bazel Eclipse Feature Logback is not loaded early enough to be used as the logger in BEF Aug 22, 2021
@plaird plaird added the BEF Bazel Eclipse label Aug 22, 2021
@plaird plaird changed the title Logback is not loaded early enough to be used as the logger in BEF Logger in BEF is not working after initial Bazel builds start Oct 9, 2021
@plaird plaird added the 1.5.0 BEF 1.5.0 label Oct 9, 2021
@plaird
Copy link
Contributor Author

plaird commented Oct 9, 2021

This was resolved by doing what we can to log to the Eclipse platform logger, but we now have a /tmp/bef.log (on Unix) which is a log file fully under our control. We send all log lines there in addition to the platform logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.5.0 BEF 1.5.0 BEF Bazel Eclipse bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant