tags:

views:

70

answers:

1

I have a Java programming lab-exercise in a course with students that I'd like to artificially write to disk in an inefficient manner. What I thought would be a mildly hard-to-find (as an exercise) would be having the app's log4j statements writing to disk in an unbuffered fashion. The app intentionally has prolific log statements.

What's the best approach for configuring log4j to use a non-buffered file appender? I'm using RollingFileAppender for now, but I don't care which file appender I ultimately use as long as it writes inefficiently to disk.

+3  A: 

FileAppender (and RollingFileAppender since it extends it) has a boolean BufferedIO property as well as BufferSize property (which you can set to 1 or some other low value).

Pick one and enjoy.

ChssPly76