Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
In the context of a REST API (but this could be a SOAP WS), I would like to be able to write in log file, also for debugging.
I could print in the console using System.out.println, however, System.out.println doesn't write in log file, so it won't be useful if the REST API job is deployed as a service.
How could I write in the log file ?
Hello,
You can setup the log4j log file by studio -> Project settings -> Log4j as the below like
<Configuration >
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] %d{HH:mm:ss} %logger{36}- %msg%n" />
</Console>
<File name="LogToFile" fileName="c:/dev/logs/test.log">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
</File>
</Appenders>
<Loggers>
<Root level="WARN">
<AppenderRef ref="Console" />
<AppenderRef ref="LogToFile" />
</Root>
</Loggers>
</Configuration>
I this logging also available when deployed ?