You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by sd...@apache.org on 2005/12/11 08:17:21 UTC
svn commit: r355934 -
/logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java
Author: sdeboy
Date: Sat Dec 10 23:17:15 2005
New Revision: 355934
URL: http://svn.apache.org/viewcvs?rev=355934&view=rev
Log:
Adding setHost and setPath methods which allow host and path to be used as application properties by subclasses (vfslogfilepatternreceiver). If attributes aren't set, the URL is parsed and host and path are used from the parsed URL.
Modified:
logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java
Modified: logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java?rev=355934&r1=355933&r2=355934&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java Sat Dec 10 23:17:15 2005
@@ -508,20 +508,29 @@
private String convertTimestamp() {
return util.substitute("s/("+VALID_DATEFORMAT_CHAR_PATTERN+")+/\\\\w+/g", timestampFormat);
}
+
+ protected void setHost(String host) {
+ this.host = host;
+ }
+
+ protected void setPath(String path) {
+ this.path = path;
+ }
/**
* Build the regular expression needed to parse log entries
*
*/
protected void initialize() {
-
- try {
- URL url = new URL(fileURL);
- host = url.getHost();
- path = url.getPath();
- } catch (MalformedURLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ if (host == null && path == null) {
+ try {
+ URL url = new URL(fileURL);
+ host = url.getHost();
+ path = url.getPath();
+ } catch (MalformedURLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
}
if (host == null || host.trim().equals("")) {
host = DEFAULT_HOST;
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org