473,659 Members | 2,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SysLogHandler is drivin me nuts

Hi there,

I am stuck while trying to use the logging facilities. Its not logging
:-) Can somebody point me to a solution ?

The following snipplets are used

-------------------------------------------
"crap.py"

logging.config. fileConfig("log ging.cfg")
logger = logging.getLogg er ("syslog")
logger.info('Wh ile this is just chatty')

-------------------------------------------
"logging.cf g"

[syslog]
class=handlers. SysLogHandler
level=ERROR
formatters=form 01
facility=LOG_LO CAL0
priority = LOG_INFO

[formatters]
keys=form01

[formatter_form0 1]
format=%(leveln ame)s %(message)s

-------------------------------------------
"/etc/syslog.conf"

local0.*;local0 .!=debug /var/log/local.log
local0.=debug /var/log/local-d.log

Kind regards

Michael
Jul 18 '05 #1
9 5633
michael wrote:
Hi there,

I am stuck while trying to use the logging facilities. Its not logging
:-) Can somebody point me to a solution ?

The following snipplets are used

-------------------------------------------
"crap.py"

logging.config. fileConfig("log ging.cfg")
logger = logging.getLogg er ("syslog")
logger.info('Wh ile this is just chatty')

-------------------------------------------
"logging.cf g"

[syslog]
class=handlers. SysLogHandler
level=ERROR
formatters=form 01
facility=LOG_LO CAL0
priority = LOG_INFO

[formatters]
keys=form01

[formatter_form0 1]
format=%(leveln ame)s %(message)s

-------------------------------------------
"/etc/syslog.conf"

local0.*;local0 .!=debug /var/log/local.log
local0.=debug /var/log/local-d.log

Kind regards

Michael


I'm taking a wild guess here(io. I haven't tested your code), but I
don't think you can expect a logger of level ERROR to logg messages of
level INFO. Try setting your log level to INFO.

regards
/rune
Jul 18 '05 #2
michael wrote:
Hi there,

I am stuck while trying to use the logging facilities. Its not logging
:-) Can somebody point me to a solution ?

The following snipplets are used

-------------------------------------------
"crap.py"

logging.config. fileConfig("log ging.cfg")
logger = logging.getLogg er ("syslog")
logger.info('Wh ile this is just chatty')

-------------------------------------------
"logging.cf g"

[syslog]
class=handlers. SysLogHandler
level=ERROR
formatters=form 01
facility=LOG_LO CAL0
priority = LOG_INFO

[formatters]
keys=form01

[formatter_form0 1]
format=%(leveln ame)s %(message)s

-------------------------------------------
"/etc/syslog.conf"

local0.*;local0 .!=debug /var/log/local.log
local0.=debug /var/log/local-d.log


The config file appears incomplete - can you post the whole of it (if
it's not too big)? I would have expected to see lines like

[loggers]
keys=root

[handlers]
keys=syslog

[logger_root]
level=DEBUG
qualname=(root)
handlers=syslog

[handler_syslog]
class=handlers. SysLogHandler
level=ERROR
formatter=form0 1
host=localhost
port=handlers.S YSLOG_UDP_PORT
facility=LOG_LO CAL0
args=(('localho st', handlers.SYSLOG _UDP_PORT),
handlers.SysLog Handler.LOG_LOC AL0)

(the args line may wrap in this mail)

You can't encode the priority in the config file - it is automatically
determined from the logging level (e.g. INFO -> LOG_INFO).

Note that the SysLogHandler communicates with the syslog daemon via UDP
and there may be network problems preventing the messages getting to the
server. If in doubt, format a UDP packet and send directly from a Python
script (i.e. not via logging) to confirm that there is no network problem.

Best regards,
Vinay Sajip
Jul 18 '05 #3
Vinay Sajip <vi*********@re d-dove.com> wrote in message news:<ma******* *************** *************** *@python.org>.. .
The config file appears incomplete - can you post the whole of it (if
it's not too big)? I would have expected to see lines like


Yep it was incomplete heres the complete config as it has to be

[loggers]
keys=root,syslo g

[handlers]
keys=syslog,fil e,stdout

[logger_syslog]
qualname=syslog
level=INFO
handlers=syslog

[logger_root]
qualname=root
level=INFO
handlers=stdout

[handler_syslog]
class=handlers. SysLogHandler
level=ERROR
formatter=syslo g
args=(('localho st', handlers.SYSLOG _UDP_PORT), handlers.SysLog Handler.LOG_USE R)

[handler_stdout]
class=StreamHan dler
level=INFO
formatter=stdou t
args=(sys.stdou t,)

[handler_file]
class=FileHandl er
level=INFO
formatter=stdou t
args=('python.l og', 'w')

[formatters]
keys=syslog,std out

[formatter_syslo g]
format=%(module )s %(levelname)s %(message)s

[formatter_stdou t]
format=%(module )s %(asctime)s %(levelname)s %(message)s

Thanks for the help

Michael
Jul 18 '05 #4
michael wrote:
Yep it was incomplete heres the complete config as it has to be

[config file snipped]

The complete file looks OK. Did you take into account the comment
roderik made (about levels - does it work if you set the logger and
handler levels both to DEBUG)? And have you checked that there is no
network problem?

Best regards,

Vinay Sajip
Jul 18 '05 #5
Vinay Sajip <vi*********@re d-dove.com> wrote in message news:<ma******* *************** *************** *@python.org>.. .
michael wrote:
Yep it was incomplete heres the complete config as it has to be

[config file snipped]

The complete file looks OK.


Thx. with this file it is working. The syslogd configuration under AIX was buggy.

regards

Michael
Jul 18 '05 #6
Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's
keyboard and not ceyboard?

Regards,
Jan
michael wrote:
Vinay Sajip <vi*********@re d-dove.com> wrote in message news:<ma******* *************** *************** *@python.org>.. .
michael wrote:
Yep it was incomplete heres the complete config as it has to be


[config file snipped]

The complete file looks OK.

Thx. with this file it is working. The syslogd configuration under AIX was buggy.

regards

Michael

Jul 18 '05 #7
Jan Dries <ja*******@dcub e-resource.be> writes:
Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's
keyboard and not ceyboard?


Your computer didn't come with a ceyboard? :)

--
Lloyd Zusman
lj*@asfast.com
God bless you.

Jul 18 '05 #8
Jan Dries <ja*******@dcub e-resource.be> wrote in message news:<ma******* *************** *************** *@python.org>.. .
Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's
keyboard and not ceyboard?


PEBCAC: Problem Exists Between Chair And Computer
Jul 18 '05 #9
[Jan Dries]
Slightly OT, but regarding the title, shouldn't it be PEBKAC,
since it's
keyboard and not ceyboard?
[Vinay Sajip] PEBCAC: Problem Exists Between Chair And Computer


Interesting. I thought it was "Problem Exists Between Keyboard And Chair".
But this makes sensee too, of course. Nonetheless, Google has about 17000
references for PEBKAC, and only 381 for PEBCAC.

Regards,
Jan
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2455
by: Doug Fort | last post by:
Hi, Perhaps this is as much a Unix question as a Python question. I really like the Python logging module, and I've used it extensively, with good results. Now I have a requirement to add a SysLogHandler, and it's just not working. It looks like the socket is connecting, but nothing comes out on the log. (Fedora Core 2 /var/log/messages) The simplest of many configurations I have tried is included below.
12
1599
by: Marty | last post by:
It seems all of the sudden that user controls that contain images are referencing image sources relative to the document that I drop the control on. This obviously does not work beacuase the image source is relative to the user control, not necessarily the form. Can anyone tell me why this would be the case?
0
970
by: Simon Harris | last post by:
Ok, this really is driving me nuts!!! :( 'All' I am trying to do is get the value of a named element. My XML doc is: <?xml version="1.0" encoding="utf-16" standalone="yes" ?> - <Page> <Title>Test</Title> <MetaKeywords>Test</MetaKeywords>
4
1649
by: trond | last post by:
Hello all, Before I start I'd like to point out that I am a complete novice when it comes to asp.net - My background is in network and operating systems, and although I have been doing a bit of hobby programming in vb.net and web programming in asp/vbscript in the past, I am pretty much a beginner at asp.net. What I'm trying to do, is to take the "PersonalHomePage" starter kit that MS supplies with VS2005 and tweak it a bit, to make it...
4
1220
by: Johnny Emde | last post by:
Hello Newsgroup I'm about going nuts!!! Sometime when I coding a asp.net (using C#) I'll get this wierd error. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
2
1127
by: Marty | last post by:
Hi, I hope you can help me with this one (my code is below my message). I have many clients connecting to my server. When any of them disconnect, something happen. This user get disconnect from the server and this is fine. But sometime, I can't reproduce exactly the situation (maybe the client crashed), the related socket in server seems to get nuts and still think
1
1563
by: windandwaves | last post by:
Hi I have the following file: --myfile.php <?php if($s) { echo $s; session_id($s); session_start;
1
3940
by: Nicholas Milkovits | last post by:
Hello all, I have a small script which attempts to write to the user.log syslog import logging, logging.handlers logger = logging.getLogger('bender') handler = logging.handlers.SysLogHandler(('localhost', logging.handlers.SYSLOG_UDP_PORT), logging.handlers.SysLogHandler.LOG_USER)
0
1088
by: MarkOlbert | last post by:
When I run the following under Python 3.1: import logging from logging.handlers import SysLogHandler logger = logging.getLogger('TestLogger') logger.setLevel(logging.DEBUG) handler = logging.handlers.SysLogHandler(address='/dev/log') logger.addHandler(handler)
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8626
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.