You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Konstantin Kolinko <kn...@gmail.com> on 2010/11/16 16:44:00 UTC

ContainerBase @trunk (Re: r1029527)

I saw the following fragment in ContainerBase.logName():
Lines 1277-1278:

 	} else if (name.startsWith("##")) {
  	   name = "/" + name;
        }

It was added by
http://svn.apache.org/viewvc?view=revision&revision=1029527

Shouldn't it be
name = "/" + name.substring(2);

Anyway,
1) I am not sure that logging categories should depend on versioning.
It would be hard to configure logging across different versions of the webapp.

I do not mind though if version will be a subcategory (a suffix
separated by a dot).

2) This code is in a loop that iterates over parents of a context. So
the name can belong to a host or an engine. (Though unlikely anyone
will name them like that, so actually I do not bother about this).


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: ContainerBase @trunk (Re: r1029527)

Posted by Rainer Jung <ra...@kippdata.de>.
On 17.11.2010 00:57, Konstantin Kolinko wrote:
> 2010/11/16 Mark Thomas<ma...@apache.org>:
>> On 16/11/2010 15:44, Konstantin Kolinko wrote:
>>> I saw the following fragment in ContainerBase.logName():
>>> Lines 1277-1278:
>>>
>>>        } else if (name.startsWith("##")) {
>>>           name = "/" + name;
>>>          }
>>>
>>> It was added by
>>> http://svn.apache.org/viewvc?view=revision&revision=1029527
>>>
>>> Shouldn't it be
>>> name = "/" + name.substring(2);
>>
>> No. The ## are intended to be part of the logger name. This code just
>> adds consistency for the ROOT webapp.
>>
>>> Anyway,
>>> 1) I am not sure that logging categories should depend on versioning.
>>> It would be hard to configure logging across different versions of the webapp.
>>
>> The general principle with the parallel deployment is as far as
>> possible to treat each version of a web application as a separate web
>> application. That means separate loggers.
>>
>
> My question is the following: these context loggers (where
> ServletContext.log() goes to) are configured once per Tomcat instance.
> AFAIK, they cannot be configured in webapp's
> WEB-INF/classes/logging.properties.
>
> If I deploy several versions of a webapp, can I configure a log file
> where all this output from that app goes to (like the default logging
> configuration does for manager and host-manager)?
>
> Or I have to list all the version numbers that I am going to use in
> the near future?
>
>
> BTW, if there is a special processing for '##', maybe one can care
> around a copy of
> org.apache.catalina.util.ContextName ?  Or use getPath() here that
> does not have that '##'.
>
> How about using the following as the logger name:
>
> org.apache.catalina.core.ContainerBase.[${engine.getName()}].[${host.getName()}].[${context.getPath()}].[${context.getWebappVersion()]
>
> with the last part being optional?  It is separated by a '.', so
> logging hierarchy comes to play here.

I also think that having a good way of configuring the loggers w.r.t. 
webappVersions is nice. It is not unlikely that admins want a consistent 
logging for the multiple versions and do not want to update log config 
whenever they deploy a new version. So supporting versions in logger 
names by adding an additional logger name hierarchy level (i.e. 
separated with a dot) makes much sense to me.

Multi version is a fundamentally different concept from multi path 
webapps. Especially the deployment dynamics we allow with the feature 
should not lead to a configuration nightmare for the admins.

Regards,

Rainer


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: ContainerBase @trunk (Re: r1029527)

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/11/16 Mark Thomas <ma...@apache.org>:
> On 16/11/2010 15:44, Konstantin Kolinko wrote:
>> I saw the following fragment in ContainerBase.logName():
>> Lines 1277-1278:
>>
>>       } else if (name.startsWith("##")) {
>>          name = "/" + name;
>>         }
>>
>> It was added by
>> http://svn.apache.org/viewvc?view=revision&revision=1029527
>>
>> Shouldn't it be
>> name = "/" + name.substring(2);
>
> No. The ## are intended to be part of the logger name. This code just
> adds consistency for the ROOT webapp.
>
>> Anyway,
>> 1) I am not sure that logging categories should depend on versioning.
>> It would be hard to configure logging across different versions of the webapp.
>
> The general principle with the parallel deployment is as far as
> possible to treat each version of a web application as a separate web
> application. That means separate loggers.
>

My question is the following: these context loggers (where
ServletContext.log() goes to) are configured once per Tomcat instance.
AFAIK, they cannot be configured in webapp's
WEB-INF/classes/logging.properties.

If I deploy several versions of a webapp, can I configure a log file
where all this output from that app goes to (like the default logging
configuration does for manager and host-manager)?

Or I have to list all the version numbers that I am going to use in
the near future?


BTW, if there is a special processing for '##', maybe one can care
around a copy of
org.apache.catalina.util.ContextName ?  Or use getPath() here that
does not have that '##'.

How about using the following as the logger name:

org.apache.catalina.core.ContainerBase.[${engine.getName()}].[${host.getName()}].[${context.getPath()}].[${context.getWebappVersion()]

with the last part being optional?  It is separated by a '.', so
logging hierarchy comes to play here.


>> I do not mind though if version will be a subcategory (a suffix
>> separated by a dot).
>
> I think the names should be consistent with the container names - as
> they are now. Look at how this is handled for a multi-level context.
>
>> 2) This code is in a loop that iterates over parents of a context. So
>> the name can belong to a host or an engine. (Though unlikely anyone
>> will name them like that, so actually I do not bother about this).
>
> Agreed.
>
> Mark
>

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: ContainerBase @trunk (Re: r1029527)

Posted by Mark Thomas <ma...@apache.org>.
On 16/11/2010 15:44, Konstantin Kolinko wrote:
> I saw the following fragment in ContainerBase.logName():
> Lines 1277-1278:
> 
>  	} else if (name.startsWith("##")) {
>   	   name = "/" + name;
>         }
> 
> It was added by
> http://svn.apache.org/viewvc?view=revision&revision=1029527
> 
> Shouldn't it be
> name = "/" + name.substring(2);

No. The ## are intended to be part of the logger name. This code just
adds consistency for the ROOT webapp.

> Anyway,
> 1) I am not sure that logging categories should depend on versioning.
> It would be hard to configure logging across different versions of the webapp.

The general principle with the parallel deployment is as far as
possible to treat each version of a web application as a separate web
application. That means separate loggers.

> I do not mind though if version will be a subcategory (a suffix
> separated by a dot).

I think the names should be consistent with the container names - as
they are now. Look at how this is handled for a multi-level context.

> 2) This code is in a loop that iterates over parents of a context. So
> the name can belong to a host or an engine. (Though unlikely anyone
> will name them like that, so actually I do not bother about this).

Agreed.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org