tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maven apache <apachemav...@gmail.com>
Subject Re: how does the tomcat log generated? log4j?
Date Sun, 26 Dec 2010 12:36:36 GMT
2010/12/26 André Warnier <aw@ice-sa.com>

> maven apache wrote:
>
>> 2010/12/25 André Warnier <aw@ice-sa.com>
>>
>>  The logging page which I pointed you to, does not say that Tomcat uses
>>> log4j.
>>> It says that you /can/ configure Tomcat to use log4j, instead of the
>>> default "juli" logging.  It even provides instructions to do so.
>>>
>>> The AccessLogValve documentation page does not say either that it uses
>>> log4j.
>>> But what it does say at the very beginning, is that the output file is
>>> changed every day at midnight.  So if you only read the files up to last
>>> night at midnight, you will never encounter the problem that something is
>>> still writing to it.
>>>
>>> Also, I do not know what your ultimate purpose is, but there exist
>>> already
>>> several open-source programs which read a logfile in the format produced
>>> by
>>> the Tomcat AccessLogValve, parse it, and produce nice graphical
>>> statistics
>>> out of it (like webalizer or awstats).  Maybe you are re-inventing
>>> something
>>> which already exists ?
>>>
>>>
>> Unfortunately yes,our boss want our own analyzer system based on java. :(
>>
>>
> Oh well, if the boss says so.
> But then I would /still/ recommend writing something in java which reads
> the above logfiles and feeds the database.  Seems a bit more reliable and
> more scaleable to me.
>

Thanks for your kind. I prefer to this manner also. And it is why I ask
problems in the stackover. :)

Of course,it is a java io question,not related to tomcat. :)




> What if the database is not available at some point for whatever reason ?
> You stop tomcat, or you lose the information ?
> In any case, you should look at the current access log files, and count the
> number of lines which it writes per second|minute|hour, and ask yourself if
> you want this number of transactions going into your database system in
> real-time.


Thanks for all your guys.


>
>
>
>
>
>
>>  Web access statistics are not usually something which needs to be
>>> accurate
>>> in real-time.
>>> Having Tomcat writing them directly to a database may have a noticeable
>>> impact on your applications performance. That's why this is something
>>> usually done off-line.
>>>
>>>  In fact,I just analyzer the logs before yesterday,it is also my boss who
>> require the real-time(almost) analysis .:)
>>
>> Thank you anyway,although having Tomcat writing logs directly to a
>> database
>> may cause performance problem,it is another way. My boss will decide it :)
>>
>>
>>
>>>
>>> maven apache wrote:
>>>
>>>  Perhaps I’m not making myself clear,in fact I want to do some processing
>>>> work to the the logs created by the access log
>>>> valve<
>>>>
>>>> http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Access_Log_Valve
>>>>
>>>>> to
>>>>>
>>>> database.
>>>>
>>>> For example:the log:
>>>>
>>>> 10.33.2.45 - - [08/Dec/2010:08:44:43 +0800] "GET /poi.txt HTTP/1.1"
>>>> 200 672 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
>>>> rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"
>>>>
>>>> will be saved in the db in this format:
>>>>
>>>> ip                  time                            method
>>>> uri               status    bytes      browser                  platform
>>>>
>>>>
>>>> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>
>>>> 10.33.2.45 2010-10-08 08:44:43  GET    /poi.txt    200    672
>>>> Firefox/3.6.8    winxp
>>>>
>>>> And now I meet some problems when I read the log file like:
>>>> localhost_access_log.2010-12-20.txt
>>>>
>>>> I read the file line by line,but sometime I can not get a complete line
>>>> since this file may be written in.
>>>>
>>>> So,someone suggest me add a db appender(log4j),which will do the
>>>> procesing
>>>> work and then export the log to db.
>>>>
>>>> -------
>>>>
>>>> Now,from the link you give me ,it seems that tomcat does use log4j to
>>>> create
>>>> its access log.
>>>>
>>>>
>>>> 2010/12/25 André Warnier <aw@ice-sa.com>
>>>>
>>>>  Hi.
>>>>
>>>>> It is not very clear what you are asking, specially since you do not
>>>>> specify which version of Tomcat your are using, under which Java
>>>>> version
>>>>> and
>>>>> on which platform.
>>>>>
>>>>> Assuming you are using Tomcat 6.0.x, the on-line documentation for
>>>>> logging
>>>>> is here :
>>>>>
>>>>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
>>>>>
>>>>> Maybe read it first, and then come back if you have a specific question
>>>>> ?
>>>>> (But then try to specify the question clearly)
>>>>>
>>>>> maven apache wrote:
>>>>>
>>>>>  Hi:
>>>>>
>>>>>> I wonder how is the tomcat log generated,I mean the log like this;
>>>>>>
>>>>>> localhost_access_log.2010-12-20.txt
>>>>>>
>>>>>> I want to export the logs to db. Some one suggestion I directly add
>>>>>> one Appender <http://logging.apache.org/log4j/1.2/apidocs/index.html>
>>>>>>
>>>>>> if tomcat also uses log4j to generate the logs and I have access
to
>>>>>> the tomcat's log4j config file.
>>>>>>
>>>>>> More details can be found in this post:
>>>>>>
>>>>>> http://stackoverflow.com/questions/4486620/randomaccessfile-probelm
>>>>>>
>>>>>> So I wonder if this is possible?
>>>>>>
>>>>>>
>>>>>>  ---------------------------------------------------------------------
>>>>>>
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>>
>>>>>
>>>>>  ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message