Ceki,
this one is for Windows (I am using on winNT)
So, configuration file for the remote machine to logging should always have a file
name called 11.22.33.44.lcf ?
Thanks!!
-----Original Message-----
From: Ceki Gülcü
Sent: Tuesday, September 25, 2001 1:46 AM
To: LOG4J Users Mailing List
Subject: Re: configureHierarchy method
What type of a machine is this? Anyway, you can modify the code so that it
takes the string after the '/' if '/' is the first character in the string. Regards,
Ceki
At 16:14 24.09.2001 -0500, you wrote:
>Hi, all.
>Following is the source code for configureHierarchy method which is in SocketServer
>class.
>The code I am in question is that when 7 and 8th line of code (including comment).
>
>When inetAddress.toString() gets executed, it returns /my.local.ip.number.
>And then next line it searches for the index of "/". Since toString method returns a
>string starting with "/", index will be set to zero.
>Thus on the else clause, "String key = s.substring(0, i);". The key variable will be
>set to blank.
>So, that is the reason why my File statement fails. (c:/.lcf will be the formed
>string)
>
>How is everybody coping with this, if you want to run the client from command line by
>passing the configuration file absolute path?
>
>Thanks for your help!!
>
>
>
> // This method assumes that there is no hiearchy for inetAddress
> // yet. It will configure one and return it.
> Hierarchy configureHierarchy(InetAddress inetAddress) {
> cat.info("Locating configuration file for "+inetAddress);
> // We assume that the toSting method of InetAddress returns is in
> // the format hostname/d1.d2.d3.d4 e.g. torino/192.168.1.1
> String s = inetAddress.toString();
> int i = s.indexOf("/");
> if(i == -1) {
> cat.warn("Could not parse the inetAddress ["+inetAddress+
> "]. Using default hierarchy.");
> return genericHierarchy();
> } else {
> String key = s.substring(0, i);
> File configFile = new File(dir, key+CONFIG_FILE_EXT);
> if(configFile.exists()) {
> Hierarchy h = new Hierarchy(new RootCategory(Priority.DEBUG));
> hierarchyMap.put(inetAddress, h);
>
> new PropertyConfigurator().doConfigure(configFile.getAbsolutePath(), h);
>
> return h;
> } else {
> cat.warn("Could not find config file ["+configFile+"].");
> return genericHierarchy();
> }
> }
> }
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü - http://qos.ch
The world owes Israel a great debt for destroying Saddam's
French built nuclear reactor in 1981 and thus preventing
nuclear blackmail in the region and perhaps beyond.
-- Garry Kasparov (yes, the chess player)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]