Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

RE: Custom appender (was Re: Building log4cxx 0.9.7 with MinGW and MSYS (no: msg#00023

apache.logging.log4cxx.user

Subject: RE: Custom appender (was Re: Building log4cxx 0.9.7 with MinGW and MSYS (no cygwin))


Thanx Curt,
The appender class which I am going to create will only be used for
obtaining the logging string from the OStream *os variable(I have found out
only this mechanism by which I can get the logging string in my own
class....is there any other method for it).This logging string will be used
for some other purpose but not for logging.
I have tried to use "log4cxx::LayoutPtr layout(new
log4cxx::PatternLayout("%m %n\n"));" --But it is giving me an error that
PatternLayout is not defined in log4cxx.


Regards
Prosenjit Sinha


-----Original Message-----
From: Curt Arnold [mailto:carnold@xxxxxxxxxx]
Sent: Tuesday, December 07, 2004 12:34 AM
To: Log4CXX User
Subject: Custom appender (was Re: Building log4cxx 0.9.7 with MinGW and MSYS
(no cygwin))

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.



Confidentiality Notice

The information contained in this electronic message and any attachments to
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or
Mailadmin@xxxxxxxxx immediately
and destroy all copies of this message and any attachments.



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation