[logback-user] Marker

ekkehard ekkehard at gentz-software.de
Mon Oct 20 13:34:38 CEST 2008


Ceki Gulcu schrieb:
> Hello Ekke,
>
> What is it that you are trying to accomplish, in plain English?
>   
My Logger objects are in each class
but I also want to know the OSGI Bundle name from where the log entry comes
and - optional - the OSGI Service names from where the event happened

I store these names in Markers, so later I can get the information to 
print them
(this was the reason I'm using a custom BundleMarkerConverter and in my 
Layout I say %bundlemarker)

the Bundle is always there
If I'm also logging from an OSGI Service I create a Marker as ServiceMarker
(there can be more then one ServiceMarkers in some situations)

I'm using bundleMarker.add(serviceMarker)

so my LogEntry has always one BundleMarker and optional one or more 
ServiceMarker added

to know if its a BundleMarker or ServiceMarker the names have a prefix 
to distinguish

for different situations or different appenders I'm using different 
MarkerConverter classes
to get %bundlemarker, %servicemarker or %bundlewithservicemarker

%bundlemarker is always only one name of the OSGI bundle
%servicemarker is empty or one or an array of OSGI Service names
and %bundlewithservicemarker is a combination of both

at the moment I have only written the MarkerConverter class for BundleMarker
and all works well

now I read about your Marker - graphs and only wanted to ask whats the 
best to get
all ServiceMarkers from the graph
to decide if a Marker is a ServiceMarker I have to see if the name 
starts with a given prefix

I hope you understand what I mean ;-)

ekke
> ekkehard wrote:
>   
>> I read about the changes with Markers - thanks - I also was thinking 
>> about Markers
>> as a tree - now I know its only a graph of connected Markers
>>
>> following scenario:
>> create a Marker with a Bundle-Name
>> add one or more Marker with Service-Names
>>
>> then I have a BundleMarkerConverter.
>> Testing
>> marker.getName().startsWith(ConstantsAndProperties.BUNDLE_MARKER_PREFIX)
>> I know if its a BundleMarker
>>
>> now there can be Markers with SERVICE_MARKER_PREFIX in the graph -
>> whats the recommanded way to get them all:
>> using the iterator ?
>>
>> thx
>>
>> ekke
>>     

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://qos.ch/pipermail/logback-user/attachments/20081020/6c2a73c3/attachment.htm 


More information about the Logback-user mailing list