Was this related to MinGW thread? I didn't appear to be so I've
changed the subject.
First, let me warn you that there are major changes forthcoming in the
CVS that will significantly impact appenders. I hope to have those
committed in the CVS within the week.
Without more details on the nature of the appender that you are
writing, it is hard to give any concrete suggestions. I assume that it
is not something that would be general purpose that would be good to
discuss openly and have added to log4cxx. If so, it would be better to
discuss it before getting down to implementation details.
Probably the best approach is to take ConsoleAppender (which derives
from WriterAppender) and start modifying it to include any needed
configuration.
On your LayoutPtr question, I you are trying to call
WriterAppender(LayoutPtr&, ostream*). Most appenders do have
non-default constructors, but they are only used in unusual
circumstances. In general, logging is configured from a configuration
file which will use the default constructor, call setOption to
configure the appender, then call activateOptions to get things ready
for use. The likely best approach is to defer constructing your
ostream until the activateOptions method and then set the
WriterAppender::os variable.
As for your actual question, it is trivial to create a LayoutPtr;
log4cxx::LayoutPtr layout; // initialized as a reference to null
or
log4cxx::LayoutPtr layout(new log4cxx::PatternLayout("%m %n\n"));
The implementation of appenders is intentionally similar to log4j. You
may find it easier to do an initial implementation and experimentation
on log4j and then port your appender to log4cxx.
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|