About the file location in File appender

Hi, When i use the file appender and specify only the log file's name (as opposed to absolute path), the log file is created in the directory from which the application is started. For instance, if i start tomcat from the tomcat bin directory, the log file is created right there in the bin directory. If i start tomcat from my home directory, the log file will be created in my home directory. Is this intentional? If so, can somebody help me understand the rational? cheers, Klaus. -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Relative paths have to be relative to something. It is almost universal that they will be relative to the path that was the working directory at the time the application was started. So in this respect Logback is just being consistent. How else would you expect it to behave? Ralph On Aug 17, 2009, at 3:47 PM, Klaus Teller wrote:
Hi,
When i use the file appender and specify only the log file's name (as opposed to absolute path), the log file is created in the directory from which the application is started.
For instance, if i start tomcat from the tomcat bin directory, the log file is created right there in the bin directory. If i start tomcat from my home directory, the log file will be created in my home directory.
Is this intentional? If so, can somebody help me understand the rational?
cheers, Klaus.
-- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

That's new to me. I don't recall that log4j is interpreting relative paths this way. In a web app for instance, I would take "relative" to mean relative to the deployment directory of the application. That is, if my app is deployed in ${TOMCAT_PATH}/webapps/myapp, a my log file my_log.txt would be located precisely in ${TOMCAT_PATH}/webapps/myapp. -------- Original-Nachricht --------
Datum: Mon, 17 Aug 2009 15:57:06 -0700 Von: Ralph Goers <rgoers@apache.org> An: logback users list <logback-user@qos.ch> Betreff: Re: [logback-user] About the file location in File appender
Relative paths have to be relative to something. It is almost universal that they will be relative to the path that was the working directory at the time the application was started. So in this respect Logback is just being consistent. How else would you expect it to behave?
Ralph
On Aug 17, 2009, at 3:47 PM, Klaus Teller wrote:
Hi,
When i use the file appender and specify only the log file's name (as opposed to absolute path), the log file is created in the directory from which the application is started.
For instance, if i start tomcat from the tomcat bin directory, the log file is created right there in the bin directory. If i start tomcat from my home directory, the log file will be created in my home directory.
Is this intentional? If so, can somebody help me understand the rational?
cheers, Klaus.
-- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser

How does a logging framework know that it is deployed in a webapp? I suppose Logback could if you were using a LoggerContext that indicated that. On Aug 17, 2009, at 4:44 PM, Klaus Teller wrote:
That's new to me. I don't recall that log4j is interpreting relative paths this way. In a web app for instance, I would take "relative" to mean relative to the deployment directory of the application. That is, if my app is deployed in ${TOMCAT_PATH}/webapps/myapp, a my log file my_log.txt would be located precisely in ${TOMCAT_PATH}/ webapps/myapp.
-------- Original-Nachricht --------
Datum: Mon, 17 Aug 2009 15:57:06 -0700 Von: Ralph Goers <rgoers@apache.org> An: logback users list <logback-user@qos.ch> Betreff: Re: [logback-user] About the file location in File appender
Relative paths have to be relative to something. It is almost universal that they will be relative to the path that was the working directory at the time the application was started. So in this respect Logback is just being consistent. How else would you expect it to behave?
Ralph
On Aug 17, 2009, at 3:47 PM, Klaus Teller wrote:
Hi,
When i use the file appender and specify only the log file's name (as opposed to absolute path), the log file is created in the directory from which the application is started.
For instance, if i start tomcat from the tomcat bin directory, the log file is created right there in the bin directory. If i start tomcat from my home directory, the log file will be created in my home directory.
Is this intentional? If so, can somebody help me understand the rational?
cheers, Klaus.
-- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Good question. I don't know the details of the log4j implementation; so, I could only speculate. What about taking the location of the configuration file as the reference directory? -------- Original-Nachricht --------
Datum: Mon, 17 Aug 2009 17:52:10 -0700 Von: Ralph Goers <rgoers@apache.org> An: logback users list <logback-user@qos.ch> Betreff: Re: [logback-user] About the file location in File appender
How does a logging framework know that it is deployed in a webapp? I suppose Logback could if you were using a LoggerContext that indicated that.
On Aug 17, 2009, at 4:44 PM, Klaus Teller wrote:
That's new to me. I don't recall that log4j is interpreting relative paths this way. In a web app for instance, I would take "relative" to mean relative to the deployment directory of the application. That is, if my app is deployed in ${TOMCAT_PATH}/webapps/myapp, a my log file my_log.txt would be located precisely in ${TOMCAT_PATH}/ webapps/myapp.
-------- Original-Nachricht --------
Datum: Mon, 17 Aug 2009 15:57:06 -0700 Von: Ralph Goers <rgoers@apache.org> An: logback users list <logback-user@qos.ch> Betreff: Re: [logback-user] About the file location in File appender
Relative paths have to be relative to something. It is almost universal that they will be relative to the path that was the working directory at the time the application was started. So in this respect Logback is just being consistent. How else would you expect it to behave?
Ralph
On Aug 17, 2009, at 3:47 PM, Klaus Teller wrote:
Hi,
When i use the file appender and specify only the log file's name (as opposed to absolute path), the log file is created in the directory from which the application is started.
For instance, if i start tomcat from the tomcat bin directory, the log file is created right there in the bin directory. If i start tomcat from my home directory, the log file will be created in my home directory.
Is this intentional? If so, can somebody help me understand the rational?
cheers, Klaus.
-- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
-- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Klaus Teller wrote:
That's new to me. I don't recall that log4j is interpreting relative paths this way. In a web app for instance, I would take "relative" to mean relative to the deployment directory of the application. That is, if my app is deployed in ${TOMCAT_PATH}/webapps/myapp, a my log file my_log.txt would be located precisely in ${TOMCAT_PATH}/webapps/myapp.
Log4j does *not* function as you describe. I should know, I wrote the code. Maybe you were defining a system variable (possibly with -D on the command line), using the said variable in your configuration file, and then you forgot that you were defining a variable to obtain the desired functionality. Is that possible? -- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch

Klaus Teller skrev:
That's new to me. I don't recall that log4j is interpreting relative paths this way. In a web app for instance, I would take "relative" to mean relative to the deployment directory of the application. That is, if my app is deployed in ${TOMCAT_PATH}/webapps/myapp, a my log file my_log.txt would be located precisely in ${TOMCAT_PATH}/webapps/myapp.
Usually relative paths are relative to the current working directory, which I believe is undefined for a web application. -- Thorbjørn Ravn Andersen "...plus... Tubular Bells!"
participants (4)
-
Ceki Gulcu
-
Klaus Teller
-
Ralph Goers
-
Thorbjoern Ravn Andersen