473,230 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

logging and propagation

oj
Hi,

I want to setup logging with two loggers:

The child logger is used when something different needs to be done
with the log record, and the log record will propagate and be logged
by the root logger as usual.

However, there are certain times when I don't want a log record to
propagate from the child to the parent.

I don't really want to add a filter to the root logger, as it should
be up to the child whether the record propagates or not.

I've tried setting the child to a lower level then the parent, but if
a record is dealt with by the child, the parent deals with it anyway
regardless of its own log level.

Also, filters only apply particular handlers and do not affect
propagation.

Can anyone suggest a simple way to achieve this?

Currently, the only thing I can think of, is overriding the
callHandlers method in a custom Logger class.
Nov 21 '07 #1
8 3542
oj <oj*****@gmail.comwrites:
Hi,

I want to setup logging with two loggers:

The child logger is used when something different needs to be done
with the log record, and the log record will propagate and be logged
by the root logger as usual.

However, there are certain times when I don't want a log record to
propagate from the child to the parent.

I don't really want to add a filter to the root logger, as it should
be up to the child whether the record propagates or not.

I've tried setting the child to a lower level then the parent, but if
a record is dealt with by the child, the parent deals with it anyway
regardless of its own log level.

Also, filters only apply particular handlers and do not affect
propagation.

Can anyone suggest a simple way to achieve this?

Currently, the only thing I can think of, is overriding the
callHandlers method in a custom Logger class.
Loggers have a "propagate" attribute. If you set this to False in the
child then you should get what you want I think.
Nov 21 '07 #2
oj
On Nov 21, 11:48 am, Paul Rudin <paul.nos...@rudin.co.ukwrote:
oj <ojee...@gmail.comwrites:
Hi,
I want to setup logging with two loggers:
The child logger is used when something different needs to be done
with the log record, and the log record will propagate and be logged
by the root logger as usual.
However, there are certain times when I don't want a log record to
propagate from the child to the parent.
I don't really want to add a filter to the root logger, as it should
be up to the child whether the record propagates or not.
I've tried setting the child to a lower level then the parent, but if
a record is dealt with by the child, the parent deals with it anyway
regardless of its own log level.
Also, filters only apply particular handlers and do not affect
propagation.
Can anyone suggest a simple way to achieve this?
Currently, the only thing I can think of, is overriding the
callHandlers method in a custom Logger class.

Loggers have a "propagate" attribute. If you set this to False in the
child then you should get what you want I think.
No, because I want message to propagate usually. There are only
specific instances when I don't want it to propagate.
Nov 21 '07 #3
oj <oj*****@gmail.comwrites:
On Nov 21, 11:48 am, Paul Rudin <paul.nos...@rudin.co.ukwrote:
>Loggers have a "propagate" attribute. If you set this to False in the
child then you should get what you want I think.

No, because I want message to propagate usually. There are only
specific instances when I don't want it to propagate.
Can't you set propagate to False during those specific instances and 1
the rest of the time?
Nov 21 '07 #4
Paul Rudin wrote:
oj <oj*****@gmail.comwrites:
>On Nov 21, 11:48 am, Paul Rudin <paul.nos...@rudin.co.ukwrote:
>>Loggers have a "propagate" attribute. If you set this to False in the
child then you should get what you want I think.

No, because I want message to propagate usually. There are only
specific instances when I don't want it to propagate.

Can't you set propagate to False during those specific instances and 1
the rest of the time?
That calls for concurrency-issues, doesn't it?

I think he will have to go down the subclass-route.

Diez
Nov 21 '07 #5
On Nov 21, 11:38 am, oj <ojee...@gmail.comwrote:
Hi,

I want to setuploggingwith two loggers:

The child logger is used when something different needs to be done
with the log record, and the log record will propagate and be logged
by the root logger as usual.

However, there are certain times when I don't want a log record to
propagate from the child to the parent.

I don't really want to add a filter to the root logger, as it should
be up to the child whether the record propagates or not.

I've tried setting the child to a lower level then the parent, but if
a record is dealt with by the child, the parent deals with it anyway
regardless of its own log level.

Also, filters only apply particular handlers and do not affect
propagation.

Can anyone suggest a simple way to achieve this?

Currently, the only thing I can think of, is overriding the
callHandlers method in a custom Logger class.
Do you already have a Logger subclass? Where and when is the decision
being made about whether to propagate or not?
Nov 22 '07 #6
oj
On Nov 22, 5:44 am, Vinay Sajip <vinay_sa...@yahoo.co.ukwrote:
On Nov 21, 11:38 am, oj <ojee...@gmail.comwrote:
Hi,
I want to setuploggingwith two loggers:
The child logger is used when something different needs to be done
with the log record, and the log record will propagate and be logged
by the root logger as usual.
However, there are certain times when I don't want a log record to
propagate from the child to the parent.
I don't really want to add a filter to the root logger, as it should
be up to the child whether the record propagates or not.
I've tried setting the child to a lower level then the parent, but if
a record is dealt with by the child, the parent deals with it anyway
regardless of its own log level.
Also, filters only apply particular handlers and do not affect
propagation.
Can anyone suggest a simple way to achieve this?
Currently, the only thing I can think of, is overriding the
callHandlers method in a custom Logger class.

Do you already have a Logger subclass? Where and when is the decision
being made about whether to propagate or not?
The decision is being made in a filter. Certain log records are dealt
with differently from there.

The filter also prevents the handler from dealing with those log
records, but it doesn't stop the handlers of parent loggers dealing
with them.
Nov 22 '07 #7
On Nov 22, 9:18 am, oj <ojee...@gmail.comwrote:
On Nov 22, 5:44 am, Vinay Sajip <vinay_sa...@yahoo.co.ukwrote:
On Nov 21, 11:38 am, oj <ojee...@gmail.comwrote:
Hi,
I want to setuploggingwith two loggers:
The child logger is used when something different needs to be done
with the log record, and the log record will propagate and be logged
by the root logger as usual.
However, there are certain times when I don't want a log record to
propagate from the child to the parent.
I don't really want to add a filter to the root logger, as it should
be up to the child whether the record propagates or not.
I've tried setting the child to a lower level then the parent, but if
a record is dealt with by the child, the parent deals with it anyway
regardless of its own log level.
Also, filters only apply particular handlers and do not affect
propagation.
Can anyone suggest a simple way to achieve this?
Currently, the only thing I can think of, is overriding the
callHandlers method in a custom Logger class.
Do you already have a Logger subclass? Where and when is the decision
being made about whether to propagate or not?

The decision is being made in a filter. Certain log records are dealt
with differently from there.

The filter also prevents the handler from dealing with those log
records, but it doesn't stop the handlers of parent loggers dealing
with them.
Why not apply the same filter to the parent loggers?
Nov 22 '07 #8
On Nov 22, 2:34 pm, Vinay Sajip <vinay_sa...@yahoo.co.ukwrote:
On Nov 22, 9:18 am, oj <ojee...@gmail.comwrote:

Why not apply the same filter to the parent loggers?
Of course, you can apply filters at the loggers or the handlers. The
filters at the logger are checked first. If they pass, then the event
is handled - and filters at the handlers get to participate.
Nov 22 '07 #9

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

Similar topics

0
by: Robert.Schmitt | last post by:
I found that the configuration system of the new logging package of Python 2.3 has some unintuitive idiosyncracies that are worth mentioning because they can cost you quite some development time...
1
by: cliff | last post by:
My asp pages will not update rigth away on my Win2k3 server with IIS 6. I have found disabling lazy content propagation but it has not worked? Has anyone else had this problem?
0
by: Karuppasamy | last post by:
H I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net I installed everything as per the Instructions given in the 'Development Using the Logging Block' ...
2
by: chuck | last post by:
I want to create two different loggers so that users see one output (e.g. no exception/stack traces) and others (e.g support staff) that does see stack traces via email. The code below is close...
9
by: Rob | last post by:
When a custom control is used within a form, that control does not get events directly. I've run into this a couple times with both mouse and keyboard events. Ex: A custom control inherits from...
1
by: Henrik Dahl | last post by:
Hello! I'm trying to propagate a ContextMenu using a HierarchicalDataTemplate. The rendering looks just fine but how do I assign the Command property and CommandParameter property of the...
3
by: Ross Boylan | last post by:
I would like my different threads to log without stepping on each other. Past advice on this list (that I've found) mostly says to send the messages to a Queue. That would work, but bypasses...
2
by: Sami | last post by:
Hello, In the Python book that I am using to learn the language it says that the traceback.print_exc() can be used to stop exception propagation and make the program keep running. Here is a...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.