incubator-empire-db-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From exxos <hat...@gmail.com>
Subject Re: Log strategry with empire-db
Date Fri, 20 Aug 2010 10:10:15 GMT
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 <francisdb@gmail.com
> wrote:

> On Fri, Aug 20, 2010 at 11:18 AM, Francis De Brabandere
> <francisdb@gmail.com> wrote:
> > On Fri, Aug 20, 2010 at 11:03 AM, exxos <hatufr@gmail.com> 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
> >> <francisdb@gmail.com> 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 <hatufr@gmail.com> 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.
>

Mime
View raw message