473,504 Members | 13,621 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using the sysloghandler class

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)
formatter = logging.Formatter('%(filename)s: %(levelname)s: %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.error('what')

but no log entries show up, however if I use the syslog module as such:
>>import syslog
syslog.syslog('testing syslog')
everything works fine. I am not sure what I am doing wrong. Any help
would be appreciated.

Thanks,

Nick
Apr 18 '07 #1
1 3930
On Apr 18, 11:42 pm, "Nicholas Milkovits" <nmilkov...@gmail.com>
wrote:
Hello all,

I have a small script which attempts to write to the user.log syslog

importlogging,logging.handlers

logger =logging.getLogger('bender')
handler =logging.handlers.SysLogHandler(('localhost',loggi ng.handlers.SYSLOG_UDP_PORT),logging.handlers.SysL ogHandler.LOG_USER)
formatter =logging.Formatter('%(filename)s: %(levelname)s: %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.error('what')

but no log entries show up, however if I use the syslog module as such:
>import syslog
syslog.syslog('testing syslog')

everything works fine. I am not sure what I am doing wrong. Any help
would be appreciated.
The logging package's syslog handler attempts to use UDP to
communicate with the syslog daemon; are you sure your system is set up
with the daemon listening on SYSLOG_UDP_PORT? If it's not, then this
could explain what you are seeing.

Regards,

Vinay Sajip

Apr 19 '07 #2

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

Similar topics

4
2049
by: Michael Sparks | last post by:
Anyway... At Europython Guido discussed with everyone the outstanding issue with decorators and there was a clear majority in favour of having them, which was good. From where I was sitting it...
1
2448
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...
5
2380
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam the list with it, unless for occasional and...
9
5627
by: michael | last post by:
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 ...
10
2631
by: Christopher Benson-Manica | last post by:
Why can't I use a class destructor in a using declaration: using MyClass::~MyClass; ? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org ...
11
6551
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
3
1989
by: flat_ross | last post by:
For anyone who is just getting into VB.NET and/or is starting to work with inheritance I would like to point out a potential pitfall. We found this confusion recently when code-reviewing an...
8
2395
by: acb | last post by:
Hi, I wrote a DLL Component (using Visual Studio 2005) and managed to include it into a C# Console application. I am now trying to include this component into a Web project. I copy the DLL...
8
8919
by: =?Utf-8?B?Q2hyaXMgSGFsY3Jvdw==?= | last post by:
Hi there I've successfully added some .NET validation controls to a page (using <asp:RequiredFieldValidator ...), however when I try to set the 'display' property to 'dynamic', my page then...
0
7213
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,...
0
7098
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...
0
7298
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,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
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...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.