I'm testing Milton WebDAV API and I need to log when some document is opened. I can have it logging on Eclipse's console, but can't make it put the message on a external file.
Found several links here at SO and Google, but none worked. I've spent about 4h in this already. Any guesses?
Here's the situation (tried to format as best as I could):
log4j.properties
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=/home/paulo/workspace/MiltonTutorial/logs/log.txt
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Root logger option
log4j.rootLogger=INFO, file
DocumentResource.java
public class DocumentResource implements GetableResource,
PropFindableResource, DeletableResource, MoveableResource,
CopyableResource, ReplaceableResource, PropPatchableResource, MultiNamespaceCustomPropertyResource {
private final static Logger log = LoggerFactory.getLogger(DocumentResource.class);
Document doc;
(...)
@Override
public void sendContent(OutputStream out, Range arg1,
Map<String, String> arg2, String arg3) throws IOException,
NotAuthorizedException, BadRequestException {
log.info(">>> File {} opened", doc.getFileName());
out.write(this.doc.getContent());
}
Eclipse's console when execute 'get testfile' on a WebDAV client
08/02/2013 18:03:15 com.ettrema.tutorial.milton.DocumentResource sendContent INFO: >>> File testfile opened
log.txt big content here
Thanks!