Patch for DebugLogPathDefiner.java

Discuss issues related to PS3 Media Server development (only for programmers)

Patch for DebugLogPathDefiner.java

Postby Thibaut » Sat Jun 18, 2011 2:48 pm

Hi
I don't where to put little patches, as it's only for linux, I did not try with Windows I put it here.
On my computer, Debian Testing, with pms svn 653, the debug file can't be created in the tmp dir because it tries to create the file /tmpdebug.log
here is my patch:
Code: Select all
--- net/pms/logging/DebugLogPathDefiner.java   (revision 653)
+++ net/pms/logging/DebugLogPathDefiner.java   (working copy)
@@ -59,7 +59,7 @@
       }
 
       // Return path to temp folder, which should be writeable
-      return System.getProperty("java.io.tmpdir");
+      return System.getProperty("java.io.tmpdir")+'/';
    }
 
 }
Thibaut
 
Posts: 6
Joined: Sat Jun 18, 2011 2:42 pm

Re: Patch for DebugLogPathDefiner.java

Postby meskibob » Sat Jun 18, 2011 5:05 pm

Moved to Dev thread.
I provide NO application support via PM or email, so please post your question to the forum per the Forum Rules.
meskibob
Moderator
 
Posts: 4784
Joined: Mon Jan 19, 2009 4:11 pm

Re: Patch for DebugLogPathDefiner.java

Postby Raptor399 » Sat Jun 18, 2011 9:07 pm

That patch might work for the posters situation, but from the looks of it needs to be more generic to be included in PMS.
Raptor399
Project Member
 
Posts: 1916
Joined: Thu Mar 10, 2011 12:06 am

Re: Patch for DebugLogPathDefiner.java

Postby chocolateboy » Sat Jun 18, 2011 9:58 pm

@Raptor399: Indeed: right idea, wrong file.

@Thibaut. Thanks. This should be fixed (in logback.xml) in r654.
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Patch for DebugLogPathDefiner.java

Postby Thibaut » Sun Jun 19, 2011 10:27 pm

Hi
Sorry to be a bit picky but your solution is not working totally.
If I don't have the write rights in the working directory, the debug.log file is created in the temp directory. That's good.
But if I have the write rights in the working directory, it will try to write in /debug.log (linux) and it can't write the file here.
Maybe the problem is more the path return in that case which is "" and put the absolute path instead.
Code: Select all
--- net/pms/logging/DebugLogPathDefiner.java   (revision 657)
+++ net/pms/logging/DebugLogPathDefiner.java   (working copy)
@@ -52,7 +52,7 @@
          file.createNewFile();
          if (file.canWrite()) {
             file.delete();
-            return "";
+            return System.getProperty("user.dir");
          }
       } catch (Exception e) {
          // Could not create / write the file
Thibaut
 
Posts: 6
Joined: Sat Jun 18, 2011 2:42 pm

Re: Patch for DebugLogPathDefiner.java

Postby chocolateboy » Sun Jun 19, 2011 10:46 pm

Thanks. Try r658.
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am


Return to Developers

Who is online

Users browsing this forum: No registered users and 4 guests