Home  >  Q&A  >  body text

java - logback can generate files, but logs cannot be output to files?

When developing in eclipse, files can be generated normally in windows, and info and debug logs can also be output. However, there is a problem when switching to the Linux environment. Files can only be generated, and the startup log can be printed. After the startup is completed, , subsequent logs cannot be output to the file.
logback.xml should be fine. I have the same configuration in another project, and logs can be printed normally, but not in new projects. Now I wonder if it is a permission issue in the Linux environment?

怪我咯怪我咯2656 days ago871

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-06-12 09:25:52

    After struggling for a long time, I finally found the problem,

    ClassPathResource classPathResource = new ClassPathResource("logback.xml");

    This method can find the configuration file path in the windows environment. Because replace is used, the path is wrong. It can be corrected after modification.

    reply
    0
  • Cancelreply