properties file exists, but still getting “WARN No appenders could be found”





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm using the pcap4j library in my application and when I run it I get:



log4j:WARN No appenders could be found for logger (org.pcap4j.core.NativeMappings).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


I also use log4j in my application:



<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>


which is configured in main/resources/log4j2-test.properties:



log4j.rootLogger=INFO, fileLogger
log4j.appender.fileLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.fileLogger.layout.ConversionPattern=%d [%t] %-5p (%F:%L) - %m%n
log4j.appender.fileLogger.File=application.log
log4j.appender.fileLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileLogger.datePattern='.'yyyy-MM-dd-HH-mm


So the configuration file is there and whatever I change in it it has an effect which means log4j sees it and it works, so I'm quite helpless when I read everywhere that this kind of warning is caused by a missing or wrong config file.



Can it be that the error is in the dependency and I can't do anything about it? If so, is there a way to disable the logging in this dependency completely? Actually this is that I would want in the first place anyway.










share|improve this question


















  • 1





    I would suggest to name the file log4j2.properties if located in src/main/resources...

    – khmarbaise
    Nov 22 '18 at 12:49











  • It made no difference unfortunately. I named it log4j2-test.properties according to the docs

    – tom
    Nov 22 '18 at 13:43


















0















I'm using the pcap4j library in my application and when I run it I get:



log4j:WARN No appenders could be found for logger (org.pcap4j.core.NativeMappings).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


I also use log4j in my application:



<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>


which is configured in main/resources/log4j2-test.properties:



log4j.rootLogger=INFO, fileLogger
log4j.appender.fileLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.fileLogger.layout.ConversionPattern=%d [%t] %-5p (%F:%L) - %m%n
log4j.appender.fileLogger.File=application.log
log4j.appender.fileLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileLogger.datePattern='.'yyyy-MM-dd-HH-mm


So the configuration file is there and whatever I change in it it has an effect which means log4j sees it and it works, so I'm quite helpless when I read everywhere that this kind of warning is caused by a missing or wrong config file.



Can it be that the error is in the dependency and I can't do anything about it? If so, is there a way to disable the logging in this dependency completely? Actually this is that I would want in the first place anyway.










share|improve this question


















  • 1





    I would suggest to name the file log4j2.properties if located in src/main/resources...

    – khmarbaise
    Nov 22 '18 at 12:49











  • It made no difference unfortunately. I named it log4j2-test.properties according to the docs

    – tom
    Nov 22 '18 at 13:43














0












0








0








I'm using the pcap4j library in my application and when I run it I get:



log4j:WARN No appenders could be found for logger (org.pcap4j.core.NativeMappings).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


I also use log4j in my application:



<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>


which is configured in main/resources/log4j2-test.properties:



log4j.rootLogger=INFO, fileLogger
log4j.appender.fileLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.fileLogger.layout.ConversionPattern=%d [%t] %-5p (%F:%L) - %m%n
log4j.appender.fileLogger.File=application.log
log4j.appender.fileLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileLogger.datePattern='.'yyyy-MM-dd-HH-mm


So the configuration file is there and whatever I change in it it has an effect which means log4j sees it and it works, so I'm quite helpless when I read everywhere that this kind of warning is caused by a missing or wrong config file.



Can it be that the error is in the dependency and I can't do anything about it? If so, is there a way to disable the logging in this dependency completely? Actually this is that I would want in the first place anyway.










share|improve this question














I'm using the pcap4j library in my application and when I run it I get:



log4j:WARN No appenders could be found for logger (org.pcap4j.core.NativeMappings).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


I also use log4j in my application:



<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>


which is configured in main/resources/log4j2-test.properties:



log4j.rootLogger=INFO, fileLogger
log4j.appender.fileLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.fileLogger.layout.ConversionPattern=%d [%t] %-5p (%F:%L) - %m%n
log4j.appender.fileLogger.File=application.log
log4j.appender.fileLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileLogger.datePattern='.'yyyy-MM-dd-HH-mm


So the configuration file is there and whatever I change in it it has an effect which means log4j sees it and it works, so I'm quite helpless when I read everywhere that this kind of warning is caused by a missing or wrong config file.



Can it be that the error is in the dependency and I can't do anything about it? If so, is there a way to disable the logging in this dependency completely? Actually this is that I would want in the first place anyway.







java maven log4j logback pcap4j






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 12:19









tomtom

742728




742728








  • 1





    I would suggest to name the file log4j2.properties if located in src/main/resources...

    – khmarbaise
    Nov 22 '18 at 12:49











  • It made no difference unfortunately. I named it log4j2-test.properties according to the docs

    – tom
    Nov 22 '18 at 13:43














  • 1





    I would suggest to name the file log4j2.properties if located in src/main/resources...

    – khmarbaise
    Nov 22 '18 at 12:49











  • It made no difference unfortunately. I named it log4j2-test.properties according to the docs

    – tom
    Nov 22 '18 at 13:43








1




1





I would suggest to name the file log4j2.properties if located in src/main/resources...

– khmarbaise
Nov 22 '18 at 12:49





I would suggest to name the file log4j2.properties if located in src/main/resources...

– khmarbaise
Nov 22 '18 at 12:49













It made no difference unfortunately. I named it log4j2-test.properties according to the docs

– tom
Nov 22 '18 at 13:43





It made no difference unfortunately. I named it log4j2-test.properties according to the docs

– tom
Nov 22 '18 at 13:43












2 Answers
2






active

oldest

votes


















0














That message is from log4j 1, whereas you are using log4j2, therefore it is harmless.



https://github.com/apache/log4j/blob/trunk/src/main/java/org/apache/log4j/Hierarchy.java



  public
void emitNoAppenderWarning(Category cat) {
// No appenders in hierarchy, warn user only once.
if(!this.emittedNoAppenderWarning) {
LogLog.warn("No appenders could be found for logger (" +
cat.getName() + ").");
LogLog.warn("Please initialize the log4j system properly.");
LogLog.warn("See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.");
this.emittedNoAppenderWarning = true;
}
}





share|improve this answer
























  • Thanks, this helped! I didn't know it's coming from an older version. I added the log4j-1.2-api bridge as dependency, and disabled the logging for pcap4j using a log4j2.xml configuration file with <Logger name="org.pcap4j" level="off">. Problem solved.

    – tom
    Nov 24 '18 at 17:48



















0














Off topic, sorry :)



You can manually set the log config file using this :



org.apache.log4j.xml.DOMConfigurator.configure("<path>log4j2-test.properties");


The <path> can either be absolute or relative to the root of your maven module.






share|improve this answer


























  • log4j sees the config file and uses it. No need to set it.

    – tom
    Nov 22 '18 at 21:55











  • okay sorry for being off topic

    – TheWildHealer
    Nov 23 '18 at 8:29












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430871%2fproperties-file-exists-but-still-getting-warn-no-appenders-could-be-found%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














That message is from log4j 1, whereas you are using log4j2, therefore it is harmless.



https://github.com/apache/log4j/blob/trunk/src/main/java/org/apache/log4j/Hierarchy.java



  public
void emitNoAppenderWarning(Category cat) {
// No appenders in hierarchy, warn user only once.
if(!this.emittedNoAppenderWarning) {
LogLog.warn("No appenders could be found for logger (" +
cat.getName() + ").");
LogLog.warn("Please initialize the log4j system properly.");
LogLog.warn("See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.");
this.emittedNoAppenderWarning = true;
}
}





share|improve this answer
























  • Thanks, this helped! I didn't know it's coming from an older version. I added the log4j-1.2-api bridge as dependency, and disabled the logging for pcap4j using a log4j2.xml configuration file with <Logger name="org.pcap4j" level="off">. Problem solved.

    – tom
    Nov 24 '18 at 17:48
















0














That message is from log4j 1, whereas you are using log4j2, therefore it is harmless.



https://github.com/apache/log4j/blob/trunk/src/main/java/org/apache/log4j/Hierarchy.java



  public
void emitNoAppenderWarning(Category cat) {
// No appenders in hierarchy, warn user only once.
if(!this.emittedNoAppenderWarning) {
LogLog.warn("No appenders could be found for logger (" +
cat.getName() + ").");
LogLog.warn("Please initialize the log4j system properly.");
LogLog.warn("See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.");
this.emittedNoAppenderWarning = true;
}
}





share|improve this answer
























  • Thanks, this helped! I didn't know it's coming from an older version. I added the log4j-1.2-api bridge as dependency, and disabled the logging for pcap4j using a log4j2.xml configuration file with <Logger name="org.pcap4j" level="off">. Problem solved.

    – tom
    Nov 24 '18 at 17:48














0












0








0







That message is from log4j 1, whereas you are using log4j2, therefore it is harmless.



https://github.com/apache/log4j/blob/trunk/src/main/java/org/apache/log4j/Hierarchy.java



  public
void emitNoAppenderWarning(Category cat) {
// No appenders in hierarchy, warn user only once.
if(!this.emittedNoAppenderWarning) {
LogLog.warn("No appenders could be found for logger (" +
cat.getName() + ").");
LogLog.warn("Please initialize the log4j system properly.");
LogLog.warn("See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.");
this.emittedNoAppenderWarning = true;
}
}





share|improve this answer













That message is from log4j 1, whereas you are using log4j2, therefore it is harmless.



https://github.com/apache/log4j/blob/trunk/src/main/java/org/apache/log4j/Hierarchy.java



  public
void emitNoAppenderWarning(Category cat) {
// No appenders in hierarchy, warn user only once.
if(!this.emittedNoAppenderWarning) {
LogLog.warn("No appenders could be found for logger (" +
cat.getName() + ").");
LogLog.warn("Please initialize the log4j system properly.");
LogLog.warn("See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.");
this.emittedNoAppenderWarning = true;
}
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 24 '18 at 15:34









devwebcldevwebcl

679923




679923













  • Thanks, this helped! I didn't know it's coming from an older version. I added the log4j-1.2-api bridge as dependency, and disabled the logging for pcap4j using a log4j2.xml configuration file with <Logger name="org.pcap4j" level="off">. Problem solved.

    – tom
    Nov 24 '18 at 17:48



















  • Thanks, this helped! I didn't know it's coming from an older version. I added the log4j-1.2-api bridge as dependency, and disabled the logging for pcap4j using a log4j2.xml configuration file with <Logger name="org.pcap4j" level="off">. Problem solved.

    – tom
    Nov 24 '18 at 17:48

















Thanks, this helped! I didn't know it's coming from an older version. I added the log4j-1.2-api bridge as dependency, and disabled the logging for pcap4j using a log4j2.xml configuration file with <Logger name="org.pcap4j" level="off">. Problem solved.

– tom
Nov 24 '18 at 17:48





Thanks, this helped! I didn't know it's coming from an older version. I added the log4j-1.2-api bridge as dependency, and disabled the logging for pcap4j using a log4j2.xml configuration file with <Logger name="org.pcap4j" level="off">. Problem solved.

– tom
Nov 24 '18 at 17:48













0














Off topic, sorry :)



You can manually set the log config file using this :



org.apache.log4j.xml.DOMConfigurator.configure("<path>log4j2-test.properties");


The <path> can either be absolute or relative to the root of your maven module.






share|improve this answer


























  • log4j sees the config file and uses it. No need to set it.

    – tom
    Nov 22 '18 at 21:55











  • okay sorry for being off topic

    – TheWildHealer
    Nov 23 '18 at 8:29
















0














Off topic, sorry :)



You can manually set the log config file using this :



org.apache.log4j.xml.DOMConfigurator.configure("<path>log4j2-test.properties");


The <path> can either be absolute or relative to the root of your maven module.






share|improve this answer


























  • log4j sees the config file and uses it. No need to set it.

    – tom
    Nov 22 '18 at 21:55











  • okay sorry for being off topic

    – TheWildHealer
    Nov 23 '18 at 8:29














0












0








0







Off topic, sorry :)



You can manually set the log config file using this :



org.apache.log4j.xml.DOMConfigurator.configure("<path>log4j2-test.properties");


The <path> can either be absolute or relative to the root of your maven module.






share|improve this answer















Off topic, sorry :)



You can manually set the log config file using this :



org.apache.log4j.xml.DOMConfigurator.configure("<path>log4j2-test.properties");


The <path> can either be absolute or relative to the root of your maven module.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 '18 at 8:28

























answered Nov 22 '18 at 16:46









TheWildHealerTheWildHealer

657323




657323













  • log4j sees the config file and uses it. No need to set it.

    – tom
    Nov 22 '18 at 21:55











  • okay sorry for being off topic

    – TheWildHealer
    Nov 23 '18 at 8:29



















  • log4j sees the config file and uses it. No need to set it.

    – tom
    Nov 22 '18 at 21:55











  • okay sorry for being off topic

    – TheWildHealer
    Nov 23 '18 at 8:29

















log4j sees the config file and uses it. No need to set it.

– tom
Nov 22 '18 at 21:55





log4j sees the config file and uses it. No need to set it.

– tom
Nov 22 '18 at 21:55













okay sorry for being off topic

– TheWildHealer
Nov 23 '18 at 8:29





okay sorry for being off topic

– TheWildHealer
Nov 23 '18 at 8:29


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430871%2fproperties-file-exists-but-still-getting-warn-no-appenders-could-be-found%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)