I use Robot Framework with custom keywords implemented in java libraries. Messages written directly to System.out from my java classes are visible in the robot output - as promised in documentation. However, since the keyword implementations are reusable components, independent from robot framework, I wanted to have more flexible logging there and not using System.out directly. I thought if I redirect my log output to System.out (with log4j's ConsoleAppender), the messages will be visible in robot output. Unfortunately it does not work.
My log4j properties file:
log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
log4j.appender.Stdout.Target=System.out
log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.Stdout.layout.conversionPattern=%d %-5p [%t] %F:%L %m%n
log4j.appender.Stdout.ImmediateFlush=true
log4j.appender.FA=org.apache.log4j.FileAppender
log4j.appender.FA.File=mylog.log
log4j.appender.FA.layout=org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern=%d %-5p [%t] %F:%L %m%n
log4j.rootLogger=INFO,Stdout,FA
The file appender works fine, the log file is created and contains all log messages, but the same messages are not visible either on console or in robot output reports. When I run my components without robot framework, the same config works for console as well.
Do you have an ideas what is wrong with the above configuration? Or any other suggestions to have robot logs while avoiding the direct usage of System.out from my java classes?