Can I have TRACE output be written to file?

130 views
Skip to first unread message

Martin Klosi

unread,
Feb 24, 2016, 3:38:20 PM2/24/16
to minlog-users
Hi. 
I'm using kryo and trying to get logging of what is actually being serialized and in what order. However, when I enable TRACE level, my console in intelli gets overloaded. Is there a way to have the log write to a file?

Nate

unread,
Feb 24, 2016, 3:51:31 PM2/24/16
to minlog...@googlegroups.com
I'm sure your IDE has a setting to write console output to a file. Otherwise you can use Log.setLogger and write code that writes to a file. You can also use System.setOut. I often use this:
http://pastebin.com/9rKXUWFu
Then:
FileOutputStream logFile = new FileOutputStream("log.txt");
System.setOut(new PrintStream(new MultiplexOutputStream(System.out, logFile), true));
System.setErr(new PrintStream(new MultiplexOutputStream(System.err, logFile), true));

-Nate


On Wed, Feb 24, 2016 at 9:04 PM, Martin Klosi <rois...@gmail.com> wrote:
Hi. 
I'm using kryo and trying to get logging of what is actually being serialized and in what order. However, when I enable TRACE level, my console in intelli gets overloaded. Is there a way to have the log write to a file?

--
--
You received this message because you are subscribed to the "minlog-users" group.
http://groups.google.com/group/minlog-users
---
You received this message because you are subscribed to the Google Groups "minlog-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minlog-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Klosi

unread,
Feb 24, 2016, 10:20:21 PM2/24/16
to minlog-users
awesome. I ended up using this:

        BufferedOutputStream bufferedOutputStream = null;
        try {
            bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(pathOutLog));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        }
        PrintStream ps = new PrintStream(bufferedOutputStream);
        System.setOut(ps);
        Log.set(Log.LEVEL_TRACE);
Reply all
Reply to author
Forward
0 new messages