Expecting Log4j LoggerContext in plugin library
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 17
- Joined: Tue Aug 15, 2023 10:58 pm
Expecting Log4j LoggerContext in plugin library
Hi,
I am working on a workbench plugin for Oxygen XML Editor 25. Our plugin uses APIs from one of our library to connect to another application from Oxygen. The library uses log4j. But we run oxygen editor from eclipse. we got following
Caused by: java.lang.ClassCastException: class org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to class org.apache.logging.log4j.core.LoggerContext (org.apache.logging.slf4j.SLF4JLoggerContext and org.apache.logging.log4j.core.LoggerContext are in unnamed module of loader 'app')
SLF4JLoggerContext
the reason is that LogManager.getContext(false) returns SLF4JLoggerContext, but the code in the library try to cast to org.apache.logging.log4j.core.LoggerContext.
Is there a way to return org.apache.logging.log4j.core.LoggerContext while LogManager.getContext(false) is called in plugin libraries?
In Oxygen XML Editor 25 there are slf4j jars.in lib. Should we remove slf4j jars from lib? is there another way to avoid the logger context issue
Thanks,
Kehua
I am working on a workbench plugin for Oxygen XML Editor 25. Our plugin uses APIs from one of our library to connect to another application from Oxygen. The library uses log4j. But we run oxygen editor from eclipse. we got following
Caused by: java.lang.ClassCastException: class org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to class org.apache.logging.log4j.core.LoggerContext (org.apache.logging.slf4j.SLF4JLoggerContext and org.apache.logging.log4j.core.LoggerContext are in unnamed module of loader 'app')
SLF4JLoggerContext
the reason is that LogManager.getContext(false) returns SLF4JLoggerContext, but the code in the library try to cast to org.apache.logging.log4j.core.LoggerContext.
Is there a way to return org.apache.logging.log4j.core.LoggerContext while LogManager.getContext(false) is called in plugin libraries?
In Oxygen XML Editor 25 there are slf4j jars.in lib. Should we remove slf4j jars from lib? is there another way to avoid the logger context issue
Thanks,
Kehua
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Expecting Log4j LoggerContext in plugin library
Hi Kehua,
Oxygen uses the SLF4j Logger for logging. It also comes with a JAR library which is a bridge between SLF4j and Log4j.
So:
Regards,
Radu
Oxygen uses the SLF4j Logger for logging. It also comes with a JAR library which is a bridge between SLF4j and Log4j.
So:
No. Maybe you can try to refer to bundle and refer to the Log4j libraries in your own Eclipse plugin. Or use SLF4j for logging in your plugin.Is there a way to return org.apache.logging.log4j.core.LoggerContext while LogManager.getContext(false) is called in plugin libraries?
In general you must not make changes inside the Oxygen plugin folder, if you were to do what you suggested for example the Oxygen plugin would break completely because it uses SLF4j extensively.In Oxygen XML Editor 25 there are slf4j jars.in lib. Should we remove slf4j jars from lib? is there another way to avoid the logger context issue
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service