R
Raga
Hi,
In the following code snippet (which is written to create a
FileAppender & make log4J log to that file):
import org.apache.log4j.*;
class sample
{
.....
HTMLLayout layout = new HTMLLayout();
layout.TITLE_OPTION = "DataSE Log";
String logFileName = "Log.txt";
Appender appender = new FileAppender(layout, logFileName, true);
appender.immediateFlush = false;
appender.bufferedIO = true;
appender.bufferSize = 64;
Logger logger = Logger.getLogger();
logger.addAppender(appender);
......
}
the above snippet is not inside any method. Its directly within the
class. In the above snippet, I am encountering 2 types of errors:
1. Am using the fields of the classes FileAppender & layout. The usage
seems to be wrong, because am getting the error "'synatx error on
token(s); misplaced construct(s)" & similar errors.
2. how to specify the bufferSize? Just as '64' or '64K'?
Thanks.
In the following code snippet (which is written to create a
FileAppender & make log4J log to that file):
import org.apache.log4j.*;
class sample
{
.....
HTMLLayout layout = new HTMLLayout();
layout.TITLE_OPTION = "DataSE Log";
String logFileName = "Log.txt";
Appender appender = new FileAppender(layout, logFileName, true);
appender.immediateFlush = false;
appender.bufferedIO = true;
appender.bufferSize = 64;
Logger logger = Logger.getLogger();
logger.addAppender(appender);
......
}
the above snippet is not inside any method. Its directly within the
class. In the above snippet, I am encountering 2 types of errors:
1. Am using the fields of the classes FileAppender & layout. The usage
seems to be wrong, because am getting the error "'synatx error on
token(s); misplaced construct(s)" & similar errors.
2. how to specify the bufferSize? Just as '64' or '64K'?
Thanks.