January 5, 20179 yr How do I log to a file? This is imperative for debugging purposes yet it seems impossible.
January 5, 20179 yr How do I log to a file? This is imperative for debugging purposes yet it seems impossible. Start the bot in debug mode from the command line and pipe to a file: java -jar "C:\Users\Username\Desktop\OSBot 2.4.107.jar" -debug (rest of params) > log_file.txt Edited January 5, 20179 yr by Explv
January 5, 20179 yr Author Start the bot in debug mode from the command line and pipe to a file: java -jar "C:\Users\Username\Desktop\OSBot 2.4.107.jar" -debug (rest of params) > log_file.txt Thank you is there somewhere i could have found that on my own?
January 5, 20179 yr Thank you is there somewhere i could have found that on my own? Well I believe I answered the same question a while ago, I can't seem to find the thread however. Also an alternative solution would be to override the log method in the MethodProvider class (which your Script extends) to write to a file instead.
January 5, 20179 yr This might inspire you http://osbot.org/forum/topic/93716-t13-introduction-to-simplog-lightweight-logging/
January 5, 20179 yr Author Well I believe I answered the same question a while ago, I can't seem to find the thread however. Also an alternative solution would be to override the log method in the MethodProvider class (which your Script extends) to write to a file instead. That's what I tried however it doesn't seem to allow any type of file IO. @[member='Override'] public void onStart() { try { out = new FileOutputStream(new File(System.getProperty("user.home"), "osmodlog.txt")); logging = true; } catch (Throwable e) { log(e); } } out would still == null during onLoop with no exception thrown. weird but not for osbot lol Edited January 5, 20179 yr by dmmslaver
January 5, 20179 yr That's what I tried however it doesn't seem to allow any type of file IO. @[member='Override'] public void onStart() { try { out = new FileOutputStream(new File(System.getProperty("user.home"), "osmodlog.txt")); logging = true; } catch (Throwable e) { log(e); } } out would still == null during onLoop with no exception thrown. weird but not for osbot lol You can only write files in the data directory, which can be retrieved using this method: http://osbot.org/api/org/osbot/rs07/script/Script.html#getDirectoryData-- Edited January 5, 20179 yr by Explv
January 5, 20179 yr That's what I tried however it doesn't seem to allow any type of file IO. @[member='Override'] public void onStart() { try { out = new FileOutputStream(new File(System.getProperty("user.home"), "osmodlog.txt")); logging = true; } catch (Throwable e) { log(e); } }out would still == null during onLoop with no exception thrown. weird but not for osbot lolIt allows it except it needs to be in c:/users/yourname/osbot/dataAlso explv provided the method for it from the api :p Edited January 5, 20179 yr by Vilius
Create an account or sign in to comment