I want my application to output logs to a the logfile in a user's home directory.
Therefore I have configured the log4j2.xml
file as below:
<Configuration>
<Properties>
<Property name="logfolder">/${sys:user.home}/xx/log/ff</Property>
</Properties>
<Appenders>
<RollingFile name="user_file" append="true" fileName="${logfolder}/logxyz.csv" filePattern="${logfolder}/old/$${date:yyyy-MM}/service-%d{MM-dd-yyyy}-%i.csv.gz">
<CsvParameterLayout format="Default" nullString="" charset="UTF-8"/>
<Policies>
I can see the logs in the specified folder, however, some errors are displayed in the console:
ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile : java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:\Users\xx/yy/log/abc/def.csv java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:\Users\xx/yy/log/abc/def.csv
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
The error seems to be related to parsing the windows files system, but I've got no idea how to go about this. Will appreciate any directions. I am developing on Windows 10, but the application logging should be cross-platform.