Closed xiaoyong-wang closed 3 years ago
Interesting. Can confirm. this is the only thing i saw while debugging was the below lines.
[10.09.2020_17-00-13] bDSwaOl/TXFMr76eKa2uQWKtbt6ZIiujsudo tail -50 /usr/local/lsws/logs/error.log
[10.09.2020_17-00-18] bDSwaOl/TXFMr76eKa2uQWKtbt6ZIiujsudo /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/serverLogs.py cleanLogFile --fileName /usr/local/lsws/logs/error.log
Running the same command manually I found.
root@server:~# sudo /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/serverLogs.py cleanLogFile --fileName /usr/local/lsws/logs/error.log
Traceback (most recent call last):
File "/usr/local/CyberCP/plogical/serverLogs.py", line 1, in <module>
from plogical import CyberCPLogFileWriter as logging
ModuleNotFoundError: No module named 'plogical'
root@server:~#
Honestly all that would be needed to clear these would be to do this via subprocess.
> /usr/local/lsws/logs/error.log
that full file for reference:
root@server:~# cat /usr/local/CyberCP/plogical/serverLogs.py
from plogical import CyberCPLogFileWriter as logging
import argparse
class serverLogs:
@staticmethod
def cleanLogFile(fileName):
try:
logFile = open(fileName,'w')
logFile.close()
print("1,None")
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[cleanLogFile]")
def main():
parser = argparse.ArgumentParser(description='CyberPanel Installer')
parser.add_argument('function', help='Specific a function to call!')
parser.add_argument('--fileName', help='File to clean.')
args = parser.parse_args()
if args.function == "cleanLogFile":
serverLogs.cleanLogFile(args.fileName)
if __name__ == "__main__":
main()
@usmannasir
I found out it happens on all the logs listed here: https://IP:8090/serverlogs/
Current Version 2.0 Build 3 Latest Version 2.0 Latest Build 3
Still an issue on current/latest
root@cyberpanel:~# sudo /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/serverLogs.py cleanLogFile --fileName /usr/local/lsws/logs/error.log
Traceback (most recent call last):
File "/usr/local/CyberCP/plogical/serverLogs.py", line 1, in <module>
from plogical import CyberCPLogFileWriter as logging
ModuleNotFoundError: No module named 'plogical'
root@cyberpanel:~# cyberpanel v
2.1.1
root@cyberpanel:~#
@usmannasir any thoughts on this one?
I think i seen what it was now. Pushed a commit to 2.1.1-dev which seems to be working for me. If you want to try upgrading to that branch and confirm its working for you too @master3395
Not sure if this is related to this change. But upgrade.py fails from 2.1.1 to 2.1.1-dev
I just ran the 2.1.1 install again, and now I can delete all logs, good work @whattheserver :)
Hi there, I use the latest version of CyberPanel, on Ubuntu 20.04. When I go to logs and then error logs, and click the Clear logs button, it doesn't do anything. I was wondering if this could get fixed, thanks!