Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to customize log4j logging?
How to customize log4j logging? [message #1758859] Mon, 03 April 2017 21:40 Go to next message
Wolfgang Schmidt is currently offline Wolfgang SchmidtFriend
Messages: 8
Registered: April 2017
Junior Member
I want to customize log4j logging in xtext regarding to https://eclipse.org/Xtext/documentation/302_configuration.html#logging but no success. It already does not work with the Eclipse standard xtext project made by the wizard. I have copied the log4j.properties file below to org.xtext.example.mydsl/src, add a validation method which creates "division by zero" exceptions to trigger logger output, rebuild the project and start the mydsl plugin in debug mode. I expect to see a log.out file but nothing. Due to the validation method I see log4j output in Eclipse's error view. Can someone please tell me what I do wrong?

# Define the root logger with appender file
log4j.rootLogger = DEBUG, FILE

# Define the file appender
log4j.appender.FILE=org.apache.log4j.FileAppender

# Set the name of the file
log4j.appender.FILE.File=${log}/log.out

# Set the immediate flush to true (default)
log4j.appender.FILE.ImmediateFlush=true

# Set the threshold to debug mode
log4j.appender.FILE.Threshold=debug

# Set the append to false, overwrite
log4j.appender.FILE.Append=false

# Define the layout for file appender
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.conversionPattern=%m%n
Re: How to customize log4j logging? [message #1758939 is a reply to message #1758859] Tue, 04 April 2017 17:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
For usage in eclipse you should follow this sentence from the docs

Quote:

In OSGi you provide configuration by creating a fragment for org.apache.log4j. In this case you need to make sure that there is not any second fragment contributing a log4j.properties file.



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: How to customize log4j logging? [message #1758957 is a reply to message #1758939] Tue, 04 April 2017 19:26 Go to previous messageGo to next message
Wolfgang Schmidt is currently offline Wolfgang SchmidtFriend
Messages: 8
Registered: April 2017
Junior Member
I know.... Wink That is the reason why I have tested it with the xtext sample project. Is the xtext project (made by the xtext wizard in Eclipse) adding a log4j fragment? If this is true do you know where I can find it?
Re: How to customize log4j logging? [message #1758961 is a reply to message #1758957] Tue, 04 April 2017 19:36 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
no,

its not and you can no find it. you have to CREATE it yourself.

wll xtext already ships with https://github.com/eclipse/xtext-eclipse/blob/master/org.eclipse.xtext.logging/
which is such a fragment.

=> you can take that as a basis,
and you have to make sure you dont start/shop that plugin if you want to ship your own (if r read that comment in the docs correct (i have never done this myself)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:JvmType content proposal
Next Topic:With operator in Xbase?
Goto Forum:
  


Current Time: Fri Dec 06 17:09:34 GMT 2024

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

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

Back to the top