Skip to main content



      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 16:28 Go to next message
Eclipse UserFriend
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 03:52 Go to previous messageGo to next message
Eclipse UserFriend
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 07:10 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: log4j.properties not updating [message #1847536 is a reply to message #1847521] Sun, 31 October 2021 11:23 Go to previous messageGo to next message
Eclipse UserFriend
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 11:25 Go to previous messageGo to next message
Eclipse UserFriend
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 12:14 Go to previous messageGo to next message
Eclipse UserFriend
You need a log4j 2 properties or xml then. But yours is for 1

[Updated on: Sun, 31 October 2021 12:15] by Moderator

Re: log4j.properties not updating [message #1847539 is a reply to message #1847538] Sun, 31 October 2021 13:53 Go to previous message
Eclipse UserFriend
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:[Xtext] Grammar - Enhancing the infered model for language expressions
Goto Forum:
  


Current Time: Sun Jun 15 01:47:51 EDT 2025

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

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

Back to the top