Hi,
Thank you very much for your support, I will configure log4j as you advised.
Best regards,
exxos.
Le 20/08/2010 12:49, Francis De Brabandere a écrit :
Normally you translate (and chain) your exceptions on each layer of
your application. That way the end user can see a simple message while
your exception chain can have some extra info for developers which can
be saved to db/mailed.
I don't see the difference between your ticket and an Exception. You
could just create a TicketException where you can add all kinds of
information...
Sorry but i can't help you more with that as it is a bit out of the
scope of empire-db.
Francis
On Fri, Aug 20, 2010 at 12:10 PM, exxos<[email protected]> wrote:
Hi Francis,
Thank you for your prompt answer and your advises.
In fact what I'm trying to put in place, is a strategy for logging, to help
the maintenance.
I'm not a specialist of Error Handling, but here is my first analyse:
When the application detects an issue with one of the layers (DB, Business,
etc...), a ticket is created with all technical information collected. It
could be an exception or a simple pojo.
This ticket can be saw as a resource and can contain functional or technical
information on the issue.
Once created, the ticket is thrown up in the above layers, until to reach
the layer in charge to respond to the end-user: commonly the controler in a
MVC model.
Now, it is the time to transform the ticket, in order to notify the end-user
and to log the issue.
For example here is the XML sent to the end-user:
<Error>
<code>345</error>
<jsession>...</jsession>
<cause>Unable to perform your request, please correct ...</cause>
and the result in the log:
Error Refernce : 345
jsession ...
resource.TestResource.test(TestResource.java:32)java.sql.Exception ...
Finaly, what I'm trying to do, is to use the same resrouce for the log than
for the end-user. This is the reason why I prefer keeping the SQL exception
under my responsability than having a SQL exception and a ticket (error
code) lost in the logs without relation each other (except may be by the
jsession).
But I know by experience that "error handling" is a really sensitive part of
systems and often not considered by developpers as it should be, mainly
focused on their business.
I do not want to "recreate the wheel" and probably it exist better and
effcient approach. Do you have advise:experience on that? I'm stil
lsearching pertinant literrature on that...
Thank you for your help.
Regards,
exxos.
On Fri, Aug 20, 2010 at 11:20 AM, Francis De Brabandere
<[email protected]> wrote:
On Fri, Aug 20, 2010 at 11:18 AM, Francis De Brabandere
<[email protected]> wrote:
On Fri, Aug 20, 2010 at 11:03 AM, exxos<[email protected]> wrote:
Hi Francis,
I use log4j too for my application. On my development view I have a
single
properties file for the whole application.
And this file is given in argement of the VM as below:
-Dlog4j.configuration=file:D:/dev/<project>/log4j.properties
in fact if you put the log4j.properties somewhere on the root of the
classpath I don't think you need this extra jvm option
if you are using maven you can put it in src/main/resources for example
let me correct this, for a webapp you probably need to add this to
your WEB-INF folder
or using maven in: src/main/webapp/WEB-INF
And here is the content of this "dev" file:
log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=D:/dev/bdtech/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
just add this
log4j.logger.org.apache.empire=OFF, R
or (might be best to show at least warnings and errors)
log4j.logger.org.apache.empire=WARN, R
you can also filter your own logging using this technique
So, this log4j.properties is shared implicitly with empire-db.
I understand that it will be better to separate each log, but here is a
development view, so...
It is best to have all logging for your application using one logging
framework, so you can stick with your current setup. It is possible
to set up log4j using the empiredb config.xml file (do you have one?)
but you don't need that since you already set up logging yourself.
Log4j supports two logging configuration formats, the .properties you
are using and the .xml format I showed you before. You have the option
to integrate the xml one into the empire-db config.xml, empiredb will
then set up logging for you.
Have a look at the basic example we provide to see how it works.
But personally I would keep the logging system you have and let
empire-db stick to its core business being sql related stuff.
Cheers,
Francis
But do you have a more details about the config.xml? Where can I find
more
information on it, than the tutorial gives?
Is it possible to give to empire-db another log4j.properties than the
one
use for Tomcat and my application?
Thank you for your help.
Regards,
exxos.
On Fri, Aug 20, 2010 at 10:30 AM, Francis De Brabandere
<[email protected]> wrote:
Could you be a bit more precise? What logging system are you using?
How do you set it up?
You can do this in the log4j:configuration section of the config.xml
if you use the empiredb configuration system. Putting
org.apache.empire to level OFF should be enough.
eg:
<logger name="org.apache.empire" additivity="false">
<level value="OFF"/>
<appender-ref ref="default"/>
</logger>
Cheers,
Francis
On Fri, Aug 20, 2010 at 10:20 AM, exxos<[email protected]> wrote:
Hi there,
Could you please advise me on how to desactivate the internal log of
empire-db?
For example prevent empire-db to log internaly SQL, internal
exceptions
or
others functional issues.
The idea is the I prefere my business to log issues...
Regards,
exxos.
--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.
--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.
--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.