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: Logging levels: msg#00026

apache.logging.log4cxx.user

Subject: RE: Logging levels

Yep using it like this makes more sense, but unfortunately again doesn't work.
I had a quick look at source code (socketappender.cpp) and looks like the
setOption function doesn't take account of the threshold.

void SocketAppender::setOption(const String& option,
const String& value)
{
if (StringHelper::equalsIgnoreCase(option, _T("remotehost")))
{
setRemoteHost(value);
}
else if (StringHelper::equalsIgnoreCase(option, _T("port")))
{
setPort(OptionConverter::toInt(value, DEFAULT_PORT));
}
else if (StringHelper::equalsIgnoreCase(option, _T("locationinfo")))
{
setLocationInfo(OptionConverter::toBoolean(value, false));
}
else if (StringHelper::equalsIgnoreCase(option,
_T("reconnectiondelay")))
{
setReconnectionDelay(OptionConverter::toInt(value,
DEFAULT_RECONNECTION_DELAY));
}
else
{
AppenderSkeleton::setOption(name, value); // This is just an
empty function
}
}

It seems simple enough to add another case to set the threshold variable - I'll
try it out later and get back to the list..


Cheers
Amit

-----Original Message-----
From: Curt Arnold [mailto:carnold@xxxxxxxxxx]
Sent: 10 August 2007 18:17
To: Log4CXX User
Subject: Re: Logging levels


On Aug 10, 2007, at 9:50 AM, Sarna, Amit wrote:

> Hi guys,
> I've seen a few threads on what I'm about to ask but no success when
> following them. I'd like to split my logging such that one appender
> logs all messages of DEBUG level and above and another logs all
> messages of WARN level and above. My current log4j config file is:
>
> log4j.rootLogger=DEBUG, myappender, SOCK
> log4j.appender.myappender=org.apache.log4j.RollingFileAppender
> log4j.appender.myappender.File=../../log/abc.log
> log4j.appender.myappender.MaxFileSize=100KB
> log4j.appender.myappender.MaxBackupIndex=1
> log4j.appender.myappender.layout=org.apache.log4j.PatternLayout
> log4j.appender.myappender.layout.ConversionPattern=%d %-5p - %m%n
> log4j.appender.SOCK=org.apache.log4j.net.SocketAppender
> log4j.appender.SOCK.RemoteHost=localhost
> log4j.appender.SOCK.Port=9245
> log4j.appender.SOCK.layout.ConversionPattern=%d{%d-%b %H:%M:%S.%J}
> tid[%t] %-5p %l %m%n log4j.appender.SOCK.layout.TimeZone=GB
> log4j.appender.SOCK.LocationInfo=true
> log4j.appender.threshold.SOCK=WARN
> log4j.debug=true
>
>

> So I'm hoping that 'myappender' logs DEBUG and above and SOCK logs
> WARN and above but this doesn't seem to work. Does any body have a
> working example of this I could look at?
>
> I'm using log4cxx 0.9.7 and I need to use with non-XML config.
>
> Many Thanks
> Amit
>
>


You are trying to set the threshold property on the SOCK appender, so the line
should be:

log4j.appender.SOCK.threshold=WARN

Unfortunately, I could not find any unit test in either log4j or log4cxx that
provided a sample configuration file that demonstrated setting the threshold on
an appender.

==============================================================================
Please access the attached hyperlink for an important electronic communications
disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================




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

Recently Viewed:
db.postgresql.b...    video.ffmpeg.us...    gis.qgis.devel/...    web.rdf.redland...    file-systems.oc...    recreation.rail...    systems.archos....    python.c++/2003...    lang.c--/2005-0...    multimedia.gpho...    network.unison....    editors.jedit.u...    hardware.pciids...    cms.tiki.cvs/20...    bug-tracking.ma...    java.hadoop.hba...    ietf.rsvp/2002-...    xfree86.devel/2...    qnx.openqnx.dev...    apache.labs.dev...    tex.pdftex/2008...    os.solaris.open...    user-groups.lin...    kde.koffice/200...   
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