Josias Thöny wrote:

On Mon, 2006-03-13 at 19:46 +0100, Michael Wechner wrote:
Andreas Hartmann wrote:

Hi Michi,

thanks for your commits - but I have some comments:

+import org.apache.log4j.Category;
please don't introduce a custom logging concept for single classes.
DefaultDocument is already LogEnabled.
I know, but the current logging concept really sucks if I might say so.
If you are able to show how one can configure it in a better way, then I am fine,
but the logging information as it is just doesn't help at all.

What I don't understand about the current logging is the logger names.
For example, the output of PublicationImpl belongs to the logger
"core.manager", and the output of DefaultDocument belongs to
"lenya.publication" (at least that's what I see in log4j.log).

It seems the names are associated to the avalon components, but it makes
it kinda difficult to filter the log output of a certain java class.

I think so too. If one uses log4j directly and uses the following pattern within log4j.xconf

<param name="ConversionPattern" value="%-4r %d [%t] %-5p %c.%M():%L %x - %m%n"/>

then debugging will become very easy, because one will know exactly what class, method and line ...

Do you think it's a "potentially harmful situation" if the method existsInAnyLanguage() returns false?

false, there is no language version and I think this should be indicated by at least a WARNING

IMHO, only the caller of this method can determine whether the result
(true or false) is harmful for the application. For the method itself,
either result is fine.

the problem I see is that the DefaultDocument is an implementation and if the implementation itself does not throw a WARNING or an ERROR, but only higher up, then it's very hard to debug where the actually problem is located. If one would throw a stacktrace then it should be alright,
but so far we don't log stacktraces for WARNINGS.

Michi

Josias

[1] http://logging.apache.org/log4j/docs/api/org/apache/log4j/Level.html


Michi

-- Andreas


+                return false;
+            }
+
+// NOTE: This seems to be unecessary because getLanguage() already creates these documents
+/*
        try {
            String[] languages = getLanguages();
            for (int i = 0; i < languages.length; i++) {
@@ -274,6 +299,7 @@
            throw new DocumentException(e);
        }
        return exists;
+*/
    }

    protected DocumentIdentifier getIdentifier() {
@@ -341,16 +367,22 @@
* @see org.apache.lenya.cms.metadata.MetaDataOwner#getMetaDataManager()
     */
    public MetaDataManager getMetaDataManager() {
+ log.debug("getSourceURI(): " + getPublication().getSourceURI());
        if (this.metaDataManager == null) {
            SourceResolver resolver = null;
            RepositorySource source = null;
            try {
resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
+
+                // TODO: This needs to be improved ...
String sourceUri = getPublication().getSourceURI() + "/content/" + getArea()
                        + getId() + "/index_" + getLanguage() + ".xml";
+
+                log.debug("Source URI: " + sourceUri);
source = (RepositorySource) resolver.resolveURI(sourceUri); this.metaDataManager = source.getNode().getMetaDataManager();
            } catch (Exception e) {
+                log.warn(e.getMessage());
                throw new RuntimeException(e);
            } finally {
                if (resolver != null) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
[EMAIL PROTECTED]                        [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to