3

Allow bigger/more log files

Atm tasker saves up to two log files of ~2mb before overwriting them. This means depending on how much you're doing with tasker, they might not reach far back. In my case there's only 2h worth of data (extensive looping) and this makes debugging quite a challenge. 

I'd like if we could increase the log size if necessary. 

4 replies

Mmm, would be a nice idea to make them store bigger amount of data. But, there's a problem: if you open that file with any text editor in a mobile device, it will take too long to open 2MB of characters, and much more if it's bigger. Also, files can be truncated. But that's my opinion.

I think I can build some project to avoid that, if we need to debug something for a long period of time. Please, check our TPC channel if you are interested on it ;)
https://t.me/tasker_advanced_channel

A

Thanks for pointing me in the right direction! I didn't know why I didn't think of just doing something myself with tasker.

The following task is triggered by a Profile whenever tasker.txt is changed. It then looks if tasker.txt.1 is existing and if it is copies it to tasker1.txt/tasker2.txt/tasker3.txt (whatever is the oldest gets replaced) and removes tasker.txt.1. The same for runlog.txt.

I strongly advise to set a cool down for this profile in its settings or it will fire all the time. Also I created this for my app so you have to change all the filenames to whatever you use e.g. /tasker/log/tasker.txt.

I didn't test it properly yet but first trails suggests it works.

Logfile_copy Premium (994)
        A1: Test File [ Type:Exists Data:Sunrise_Alarm/log/tasker.txt.1 Store Result In:%test Use Root:Off ] 
        A2: If [ %test ~ true ]
        A3: Array Set [ Variable Array:%files Values:Sunrise_Alarm/log/tasker1.txt,Sunrise_Alarm/log/tasker2.txt,Sunrise_Alarm/log/tasker3.txt Splitter:, ] 
        A4: For [ Variable:%item Items:%files() ] 
        A5: Test File [ Type:Exists Data:%item Store Result In:%test Use Root:Off ] 
        A6: If [ %test ~ false ]
        A7: Copy File [ From:Sunrise_Alarm/log/tasker.txt.1 To:%item Use Root:Off ] 
        A8: Variable Set [ Name:%copied To:1 Recurse Variables:Off Do Maths:Off Append:Off ] 
        A9: End If 
        A10: End For 
        A11: If [ %copied !Set ]
        A12: For [ Variable:%item Items:%files() ] 
        A13: Variable Set [ Name:%index To:%index + 1 Recurse Variables:Off Do Maths:On Append:Off ] 
        A14: Test File [ Type:Modified Data:%item Store Result In:%age(%index) Use Root:Off ] 
        A15: End For 
        A16: Array Set [ Variable Array:%agesort Values:%age1,%age2,%age3 Splitter:, ] 
        A17: Array Process [ Variable Array:%agesort Type:Sort Numeric, Integer ] 
        A18: Variable Set [ Name:%oldest To:%age(#?%agesort1) Recurse Variables:Off Do Maths:Off Append:Off ] 
        A19: Delete File [ File:%files(%oldest) Shred Level:0 Use Root:Off ] 
        A20: Copy File [ From:Sunrise_Alarm/log/tasker.txt.1 To:%files(%oldest) Use Root:Off ] 
        A21: End If 
        A22: Delete File [ File:Sunrise_Alarm/log/tasker.txt.1 Shred Level:0 Use Root:Off ] 
        A23: End If 
        A24: Test File [ Type:Exists Data:Sunrise_Alarm/log/runlog.txt.1 Store Result In:%test Use Root:Off ] 
        A25: If [ %test ~ true ]
        A26: Variable Clear [ Name:%copied Pattern Matching:Off Local Variables Only:Off ] 
        A27: Variable Clear [ Name:%index Pattern Matching:Off Local Variables Only:Off ] 
        A28: Array Clear [ Variable Array:%agesort ] 
        A29: Array Clear [ Variable Array:%age ] 
        A30: Array Clear [ Variable Array:%files ] 
        A31: Array Set [ Variable Array:%files Values:Sunrise_Alarm/log/runlog1.txt,Sunrise_Alarm/log/runlog2.txt,Sunrise_Alarm/log/runlog3.txt Splitter:, ] 
        A32: For [ Variable:%item Items:%files() ] 
        A33: Test File [ Type:Exists Data:%item Store Result In:%test Use Root:Off ] 
        A34: If [ %test ~ false ]
        A35: Copy File [ From:Sunrise_Alarm/log/runlog.txt.1 To:%item Use Root:Off ] 
        A36: Variable Set [ Name:%copied To:1 Recurse Variables:Off Do Maths:Off Append:Off ] 
        A37: End If 
        A38: End For 
        A39: If [ %copied !Set ]
        A40: For [ Variable:%item Items:%files() ] 
        A41: Variable Set [ Name:%index To:%index + 1 Recurse Variables:Off Do Maths:On Append:Off ] 
        A42: Test File [ Type:Modified Data:%item Store Result In:%age(%index) Use Root:Off ] 
        A43: End For 
        A44: Array Set [ Variable Array:%agesort Values:%age1,%age2,%age3 Splitter:, ] 
        A45: Array Process [ Variable Array:%agesort Type:Sort Numeric, Integer ] 
        A46: Variable Set [ Name:%oldest To:%age(#?%agesort1) Recurse Variables:Off Do Maths:Off Append:Off ] 
        A47: Delete File [ File:%files(%oldest) Shred Level:0 Use Root:Off ] 
        A48: Copy File [ From:Sunrise_Alarm/log/runlog.txt.1 To:%files(%oldest) Use Root:Off ] 
        A49: End If 
        A50: Delete File [ File:Sunrise_Alarm/log/runlog.txt.1 Shred Level:0 Use Root:Off ] 
        A51: End If 

Thanks for sharing! Seems very interested ;)

A

There is minor error in my task. Fixed version:

Logfile_copy Premium (994)
        A1: Test File [ Type:Exists Data:Sunrise_Alarm/log/tasker.txt.1 Store Result In:%test Use Root:Off ] 
        A2: If [ %test ~ true ]
        A3: Array Set [ Variable Array:%files Values:Sunrise_Alarm/log/tasker1.txt,Sunrise_Alarm/log/tasker2.txt,Sunrise_Alarm/log/tasker3.txt Splitter:, ] 
        A4: For [ Variable:%item Items:%files() ] 
        A5: Test File [ Type:Exists Data:%item Store Result In:%test Use Root:Off ] 
        A6: If [ %test ~ false & %copied !Set ]
        A7: Copy File [ From:Sunrise_Alarm/log/tasker.txt.1 To:%item Use Root:Off ] 
        A8: Variable Set [ Name:%copied To:1 Recurse Variables:Off Do Maths:Off Append:Off ] 
        A9: End If 
        A10: End For 
        A11: If [ %copied !Set ]
        A12: For [ Variable:%item Items:%files() ] 
        A13: Variable Set [ Name:%index To:%index + 1 Recurse Variables:Off Do Maths:On Append:Off ] 
        A14: Test File [ Type:Modified Data:%item Store Result In:%age(%index) Use Root:Off ] 
        A15: End For 
        A16: Array Set [ Variable Array:%agesort Values:%age1,%age2,%age3 Splitter:, ] 
        A17: Array Process [ Variable Array:%agesort Type:Sort Numeric, Integer ] 
        A18: Variable Set [ Name:%oldest To:%age(#?%agesort1) Recurse Variables:Off Do Maths:Off Append:Off ] 
        A19: Delete File [ File:%files(%oldest) Shred Level:0 Use Root:Off ] 
        A20: Copy File [ From:Sunrise_Alarm/log/tasker.txt.1 To:%files(%oldest) Use Root:Off ] 
        A21: End If 
        A22: Delete File [ File:Sunrise_Alarm/log/tasker.txt.1 Shred Level:0 Use Root:Off ] 
        A23: End If 
        A24: Test File [ Type:Exists Data:Sunrise_Alarm/log/runlog.txt.1 Store Result In:%test Use Root:Off ] 
        A25: If [ %test ~ true ]
        A26: Variable Clear [ Name:%copied Pattern Matching:Off Local Variables Only:Off ] 
        A27: Variable Clear [ Name:%index Pattern Matching:Off Local Variables Only:Off ] 
        A28: Array Clear [ Variable Array:%agesort ] 
        A29: Array Clear [ Variable Array:%age ] 
        A30: Array Clear [ Variable Array:%files ] 
        A31: Array Set [ Variable Array:%files Values:Sunrise_Alarm/log/runlog1.txt,Sunrise_Alarm/log/runlog2.txt,Sunrise_Alarm/log/runlog3.txt Splitter:, ] 
        A32: For [ Variable:%item Items:%files() ] 
        A33: Test File [ Type:Exists Data:%item Store Result In:%test Use Root:Off ] 
        A34: If [ %test ~ false & %copied !Set ]
        A35: Copy File [ From:Sunrise_Alarm/log/runlog.txt.1 To:%item Use Root:Off ] 
        A36: Variable Set [ Name:%copied To:1 Recurse Variables:Off Do Maths:Off Append:Off ] 
        A37: End If 
        A38: End For 
        A39: If [ %copied !Set ]
        A40: For [ Variable:%item Items:%files() ] 
        A41: Variable Set [ Name:%index To:%index + 1 Recurse Variables:Off Do Maths:On Append:Off ] 
        A42: Test File [ Type:Modified Data:%item Store Result In:%age(%index) Use Root:Off ] 
        A43: End For 
        A44: Array Set [ Variable Array:%agesort Values:%age1,%age2,%age3 Splitter:, ] 
        A45: Array Process [ Variable Array:%agesort Type:Sort Numeric, Integer ] 
        A46: Variable Set [ Name:%oldest To:%age(#?%agesort1) Recurse Variables:Off Do Maths:Off Append:Off ] 
        A47: Delete File [ File:%files(%oldest) Shred Level:0 Use Root:Off ] 
        A48: Copy File [ From:Sunrise_Alarm/log/runlog.txt.1 To:%files(%oldest) Use Root:Off ] 
        A49: End If 
        A50: Delete File [ File:Sunrise_Alarm/log/runlog.txt.1 Shred Level:0 Use Root:Off ] 
        A51: End If 
A

It turns out the profile activating if tasker.txt is modified spams the log. I am looking into what other event to use to trigger my task.

A

Just use the FOLDER of the log files and monitor it for changes. Whenever a new file is added, the profile fires. Works beautifully.