Mycat启动时日志报log4j:ERROR setFile(null,false) call failed.

时间:2021-02-20 17:29:12
INFO   | jvm 1    | 2016/06/20 23:00:27 | log4j:ERROR setFile(null,false) call failed.
INFO | jvm 1 | 2016/06/20 23:00:27 | java.io.FileNotFoundException: ./logs/mycat.log (Permission denied)
INFO | jvm 1 | 2016/06/20 23:00:27 | at java.io.FileOutputStream.open(Native Method)
INFO | jvm 1 | 2016/06/20 23:00:27 | at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
INFO | jvm 1 | 2016/06/20 23:00:27 | at java.io.FileOutputStream.<init>(FileOutputStream.java:136)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:492)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1006)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:872)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:755)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.opencloudb.Log4jInitializer$XMLWatchdog.doOnChange(Log4jInitializer.java:53)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:89)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.apache.log4j.helpers.FileWatchdog.<init>(FileWatchdog.java:58)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.opencloudb.Log4jInitializer$XMLWatchdog.<init>(Log4jInitializer.java:48)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.opencloudb.Log4jInitializer.configureAndWatch(Log4jInitializer.java:39)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.opencloudb.MycatServer.beforeStart(MycatServer.java:187)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.opencloudb.MycatStartup.main(MycatStartup.java:51)
INFO | jvm 1 | 2016/06/20 23:00:27 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2016/06/20 23:00:27 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
INFO | jvm 1 | 2016/06/20 23:00:27 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2016/06/20 23:00:27 | at java.lang.reflect.Method.invoke(Method.java:601)
INFO | jvm 1 | 2016/06/20 23:00:27 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO | jvm 1 | 2016/06/20 23:00:27 | at java.lang.Thread.run(Thread.java:722)
INFO | jvm 1 | 2016/06/20 23:00:27 | log4j 2016-06-20 23:00:27 [./conf/log4j.xml] load completed.
INFO | jvm 1 | 2016/06/20 23:00:27 | MyCAT Server startup successfully. see logs in logs/mycat.log
STATUS | wrapper | 2016/06/21 21:42:04 | TERM trapped. Shutting down.
STATUS | wrapper | 2016/06/21 21:42:06 | <-- Wrapper Stopped
STATUS | wrapper | 2016/06/21 21:44:26 | --> Wrapper Started as Daemon
STATUS | wrapper | 2016/06/21 21:44:26 | Launching a JVM...

这个错误找不到那个文件或者目录java.io.FileNotFoundException: ./logs/mycat.log (Permission denied) 如果权限不足时就会发生这个错误,

修改成root用户之后就可以了

INFO   | jvm 1    | 2016/06/21 21:44:27 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO | jvm 1 | 2016/06/21 21:44:27 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
INFO | jvm 1 | 2016/06/21 21:44:27 |
INFO | jvm 1 | 2016/06/21 21:44:27 | log4j 2016-06-21 21:44:27 [./conf/log4j.xml] load completed.
INFO | jvm 1 | 2016/06/21 21:44:28 | MyCAT Server startup successfully. see logs in logs/mycat.log