functions: logging: use printer_data

This commit is contained in:
alfrix 2022-11-01 17:54:01 -03:00
parent 03e4681aa6
commit 79c858ded6
3 changed files with 16 additions and 7 deletions

View File

@ -5,12 +5,17 @@ This page will have common problems and common solutions to those problems.
The first step to troubleshooting any problem is getting the cause of the error.
* Check for the file `/tmp/KlipperScreen.log`
* Find KlipperScreen.log:
look at the contents by running `cat /tmp/KlipperScreen.log` or grab the file over WinSCP or another sftp program.
This is the most important file, and should be provided if you ask for support.
!!! important
This log file should be provided if you ask for support.
If that file is non-existent, run `journalctl -xe -u KlipperScreen`
Depending on your setup the file could be accesible from the web interface (Mainsail/Fluidd) alongside other logs
Located at `~/printer_data/logs`or in `/tmp/` if the former doesn't exists.
If KlipperScreen.log doesn't exist, run `systemctl status KlipperScreen`
(or `journalctl -xe -u KlipperScreen`)
Check the file `/var/log/Xorg.0.log` where you can find issues with the X server.

View File

@ -157,7 +157,6 @@ def setup_logging(log_file, software_version):
stdout_fmt = logging.Formatter(
'%(asctime)s [%(filename)s:%(funcName)s()] - %(message)s')
stdout_hdlr.setFormatter(stdout_fmt)
fh = listener = None
try:
if os.path.exists(log_file):

View File

@ -1123,12 +1123,17 @@ class KlipperScreen(Gtk.Window):
def main():
version = functions.get_software_version()
parser = argparse.ArgumentParser(description="KlipperScreen - A GUI for Klipper")
homedir = os.path.expanduser("~")
parser.add_argument(
"-c", "--configfile", default="~/KlipperScreen.conf", metavar='<configfile>',
"-c", "--configfile", default=os.path.join(homedir, "KlipperScreen.conf"), metavar='<configfile>',
help="Location of KlipperScreen configuration file"
)
logdir = os.path.join(homedir, "printer_data", "logs")
if not os.path.exists(logdir):
logdir = "/tmp"
parser.add_argument(
"-l", "--logfile", default="/tmp/KlipperScreen.log", metavar='<logfile>',
"-l", "--logfile", default=os.path.join(logdir, "KlipperScreen.log"), metavar='<logfile>',
help="Location of KlipperScreen logfile output"
)
args = parser.parse_args()