Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » log4j.properties not updating(changed log4j.properties not picking up changed properties file)
log4j.properties not updating [message #1847489] Thu, 28 October 2021 20:28 Go to next message
Don Flinn is currently offline Don FlinnFriend
Messages: 5
Registered: August 2018
Junior Member
I have a simple maven project which uses log4j.properites. The Properties file is in sources/resources.
My java file
========================
package man1;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

package man1;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class BlankOwl {
static final Logger logger = LogManager.getLogger(BlankOwl.class);

public static void main(String[] args) {
logger.debug("using logger debug");
logger.info("using logger info");
logger.warn("using logger warn");
logger.error("using logger error");
logger.fatal("using logger fatal");

}
}

my properties file
# initialize root logger with level debug for stdout and fout
log4j.rootLogger=fatal,consol,fout
# set the log level for these components
#log4j.logger.com.endeca=INFO
#log4j.logger.com.endeca.itl.web.metrics=INFO

# add a ConsoleAppender to the logger stdout to write to the console
log4j.appender.consol=org.apache.log4j.ConsoleAppender
log4j.appender.consol.layout=org.apache.log4j.PatternLayout
# use a simple message format
log4j.appender.stdout.layout.ConversionPattern=%m%n

# add a FileAppender to the logger file
log4j.appender.fout=org.apache.log4j.FileAppender
# create a log file
log4j.appender.fout.File=C:/Users/flinn/logs/man3.txt
log4j.appender.fout.layout=org.apache.log4j.PatternLayout
# use a more detailed message pattern
log4j.appender.fout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n

I can change the root property from debug to fatal in the properties file and the program only outputs error and fatal, no matter what changes are made to the root level. It also does not write the file. I've read & tried all the online suggestions I could find to no avail. I'm in the process of tearing out what hair I have left. Any help is appreciated; With the code, not the hair{-:
Don

Re: log4j.properties not updating [message #1847516 is a reply to message #1847489] Sat, 30 October 2021 07:52 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7468
Registered: July 2009
Senior Member
Hi

maybe it's just the typo, though log4j config can be hard with Xtext since usually it all works fine for free, but with Tycho the free config gets lost.

log4j.appender.consol.layout

Try "console".

Regards

Ed Willink
Re: log4j.properties not updating [message #1847521 is a reply to message #1847516] Sat, 30 October 2021 11:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14263
Registered: July 2009
Senior Member
you code seems to be a wild mix of log4j 1 and 2.
maybe you should use a consistent version across the java file and properties


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: log4j.properties not updating [message #1847536 is a reply to message #1847521] Sun, 31 October 2021 15:23 Go to previous messageGo to next message
Don Flinn is currently offline Don FlinnFriend
Messages: 5
Registered: August 2018
Junior Member
Hi Christian
What I have read, if I interpreted it correctly, is that log4j 1 has reached end of life. Further there is no longer a log4j 2, it is just log4j. I have purged my .p and .m directories and reinstalled eclipse and rerun Maven update. Still no success. Don
Re: log4j.properties not updating [message #1847537 is a reply to message #1847516] Sun, 31 October 2021 15:25 Go to previous messageGo to next message
Don Flinn is currently offline Don FlinnFriend
Messages: 5
Registered: August 2018
Junior Member
I corrected console, But still no success. Don
Re: log4j.properties not updating [message #1847538 is a reply to message #1847537] Sun, 31 October 2021 16:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14263
Registered: July 2009
Senior Member
You need a log4j 2 properties or xml then. But yours is for 1

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sun, 31 October 2021 16:15]

Report message to a moderator

Re: log4j.properties not updating [message #1847539 is a reply to message #1847538] Sun, 31 October 2021 17:53 Go to previous message
Don Flinn is currently offline Don FlinnFriend
Messages: 5
Registered: August 2018
Junior Member
Thank you all. I have decided to switch to Java Logging. See https://mkyong.com/logging/java-logging-apis-tutorial/ for a way to implement this. It is working smoothly for me. Don
Previous Topic:using custom java bean in my language
Next Topic:Semantic Token support on Xtext LSP
Goto Forum:
  


Current Time: Sat May 28 02:33:06 GMT 2022

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

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

Back to the top