Hi David
I've forked and added a "formatter" branch:
https://github.com/leemhenson/trinidad/tree/formatter
I've created a new jar containing a single class:
=========== TerseFormatter.java =============
package org.trinidad.logging;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
public class TerseFormatter extends Formatter {
private static final DateFormat format = new SimpleDateFormat("yyyy-
MM-dd HH:mm:ss");
@Override
public String format(LogRecord record) {
StringBuffer sb = new StringBuffer();
sb.append(format.format(new Date(record.getMillis())));
sb.append(" ");
sb.append(record.getLevel().getName());
sb.append(": ");
sb.append(record.getMessage());
return sb.toString();
}
}
========================================
Unfortunately it is being ignored by logging system. There aren't any
errors being generated when I run "rake spec", but the log messages
are still the same old format.
1) Any ideas? I believe the old call to "log_handler.formatter =
SimpleFormatter.new" was silently being ignored as well. You can even
comment that line out entirely and the behaviour is unchanged. From
looking at LogManager there appears to be some sort of configuration
you can do from an xml file, or java properties. I'm not experienced
with java so this is all a bit impenetrable to me at the moment.
2) Where would you like me to put the TerseFormatter.java in git?
cheers
lee
On Jul 6, 3:49 pm, David Calavera <
david.calav...@gmail.com> wrote:
> Hi Lee,
>
> the short answer to that question is "yes and no" :P
>
> Some time ago I wrote an extension that allowed to modify the log format
> using log4j, I think that would be the easier solution to your issue:
>
>
https://github.com/calavera/trinidad_logging_extension
>
> The solution slightly harder, but not too much, would be to modify the log
> formatter that Trinidad uses by default. I've heard other people complaining
> about this, so maybe we need to go with this solution.
>
> This is where we set the default log formatter:
>
>
https://github.com/trinidad/trinidad/blob/master/lib/trinidad/lifecyc...