Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Configuring Log4J
Configuring Log4J [message #759520] Mon, 28 November 2011 22:15 Go to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
Hi all,

I am trying to configure Log4J for Xtext however I couldn't get it working.
Obviously I did something wrong so below you can find the steps that I took.

I created a fragment project in eclipse with the following Manifest:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.my.company.log4j.config
Bundle-SymbolicName: org.my.company.log4j.config
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.apache.log4j;bundle-version="1.2.15.v201012070815"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6


In the source folder I have the following log4j.properties file:

log4j.rootCategory=INFO, S

log4j.logger.org.eclipse.xtext=DEBUG

log4j.appender.S = org.apache.log4j.ConsoleAppender
log4j.appender.S.layout = org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n


I exported the project as a deployable fragment and added the resulting jar file to the classpath of my project. However I do not get any messages in the console.

What is the right way to configure log4J?

Thanks in advance.
Re: Configuring Log4J [message #759560 is a reply to message #759520] Tue, 29 November 2011 08:11 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3101
Registered: July 2009
Senior Member
Goran,

did you remove org.eclipse.xtext.logging from your launch configuration?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 28.11.11 23:15, schrieb Goran:
> Hi all,
>
> I am trying to configure Log4J for Xtext however I couldn't get it working.
> Obviously I did something wrong so below you can find the steps that I
> took.
>
> I created a fragment project in eclipse with the following Manifest:
>
>
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: org.my.company.log4j.config
> Bundle-SymbolicName: org.my.company.log4j.config
> Bundle-Version: 1.0.0.qualifier
> Fragment-Host: org.apache.log4j;bundle-version="1.2.15.v201012070815"
> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>
>
> In the source folder I have the following log4j.properties file:
>
>
> log4j.rootCategory=INFO, S
>
> log4j.logger.org.eclipse.xtext=DEBUG
>
> log4j.appender.S = org.apache.log4j.ConsoleAppender
> log4j.appender.S.layout = org.apache.log4j.PatternLayout
> log4j.appender.S.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss}
> %c{1} [%p] %m%n
>
>
> I exported the project as a deployable fragment and added the resulting
> jar file to the classpath of my project. However I do not get any
> messages in the console.
>
> What is the right way to configure log4J?
>
> Thanks in advance.
Re: Configuring Log4J [message #759636 is a reply to message #759560] Tue, 29 November 2011 12:24 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
Thanks Sebastian,

Now it works!
Re: Configuring Log4J [message #1809610 is a reply to message #759636] Thu, 18 July 2019 19:38 Go to previous messageGo to next message
shruthi nadig is currently offline shruthi nadigFriend
Messages: 7
Registered: July 2019
Junior Member
Hi Sebastian/Goran, I am stuck with same problem. Below are the steps I followed:
1:Created a logging fragment "X"as above and download the fragment plugin by installing a new software option .
2:Now I have a project "Z" to run which uses another custom plugin "Y" which we have built. The custom plugin"Y" has log4j statements.
I would like to see the log statements present in Y when we run the project "Z" on console. Please help....
Re: Configuring Log4J [message #1809758 is a reply to message #1809610] Mon, 22 July 2019 16:37 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6457
Registered: July 2009
Senior Member
Hi

Thank you for activating this old thread. A "log4j:WARN Please initialize the log4j system properly." in my Tycho Surefire tests has been bugging me for some time.

It looks as if some of the information such as https://kthoms.wordpress.com/2010/08/18/building-xtext-projects-with-maven-tycho/ is now out of date. It appears to recommend ch.qos.logback.classic that is not available on my installation.

I found that the https://wiki.eclipse.org/Tycho/FAQ#How_do_I_install_the_org.eclipse.osgi.compatibility.state_fragment.3F approach works.

Just add:

<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.xtext.logging</id>
<versionRange>[1.0.0,2.0.0)</versionRange>
</requirement>

to get the elusive fragment installed.

Regards

Ed Willink
Previous Topic:No LSP suggestions when keywords are separate parser rules
Next Topic:Throw error in generator
Goto Forum:
  


Current Time: Tue Sep 17 18:56:24 GMT 2019

Powered by FUDForum. Page generated in 0.02290 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top