Affichage des articles dont le libellé est log. Afficher tous les articles
Affichage des articles dont le libellé est log. Afficher tous les articles

dimanche 12 mai 2013

archlinux pacman helper

I don't always follow pacman updates output. I believe this behavior was the reason I was left with an unbootable system. Mainly because of a long time due change for /bin/systemd to be removed, /bin/init being the sole entry point for the bootloader to continue. Anyway, as for LFS (Linux From Scratch), logging things could help, so as for now I'll use :

pacman -Su | tee pacman.dash.Su.`date +%d%b%G_%H%M%S`.log

in order to be able to read useful information later on.

samedi 24 novembre 2012

lennart's day : pulseaudio, systemd, initials and misconfigured system

I stumbled upon some kind of leak. /var/log/journal is eating 2GB. That explains why journalctl is sluggish as hell.

luser@x60s_GPT ~ % journalctl | awk '{print $5}' | sed 's,[^a-zA-Z\-],,g' > log
# 2 hours and 22MB later

luser@x60s_GPT ~ % sort log | uniq -c | sort -nr | head
1953078 pulseaudio
  62863 kernel
  39051 systemd
  14992 sudo
  14463 udisks-daemon
   7923 USRSBINCROND
   4015 usrsbincrond
   1601 dhcpcd
    733 systemd-logind
    704 systemd-journal


So pulseaudio is the prime suspect. A while back I used '-vvvv' for debugging purposes, but removed the vvvverbose option for at least a few weeks. It was dropping dozens of messages every 5 seconds and I can't find a way to trim the old persisted logs. I'm tempted to blindly delete them but will wait a bit before doing so.

tl;dr still looking for a way to manage, meaning trim, systemd journal disk usage a posteriori in case of log bloat.

Trivia: journal log header include LPKSHHRH. I thought it was a compression format magic number, PKZIP comes to mind, but apparently it is more of a signature.


LPKSHHRH acronym
LP KS HH RH ;)






ha, computers. I mean noobs.

dimanche 19 février 2012

debugging notes with python

- with pdb, use aliases

# Ned's .pdbrc
# Print a dictionary, sorted. %1 is the dict, %2 is the prefix for the names.
alias p_ for k in sorted(%1.keys()): print "%s%-15s= %-80.80s" % ("%2",k,repr(%1[k]))
alias pi p_ %1.__dict__ %1. .. # instance variables of %1
alias ps pi self ............. # instance variables of self.
alias pl p_ locals() local: .. # Print the locals.
alias nl n;;l ................ # Next and list.
alias sl s;;l ................ # and step and list.
alias uu u;;u ................ # up the stack
alias dd d;;d ................ # down the stack
source : http://stackoverflow.com/a/1624037
- use sys hooks to react on exception


def traceit(frame, event, arg):
   if event == "line":
        lineno = frame.f_lineno
        print "line", lineno
   return traceit

def main():
print 
"In main" for i in range(5): print i, i*3 print "Done."

sys.settrace(traceit)
main()
source : http://www.dalkescientific.com/writings/diary/archive/2005/04/20/tracing_python_code.html
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# code snippet, to be included in 'sitecustomize.py'
import sys

def info(type, value, tb):
   if hasattr(sys, 'ps1') or not sys.stderr.isatty():
      # we are in interactive mode or we don't have a tty-like
      # device, so we call the default hook
      sys.__excepthook__(type, value, tb)
   else:
      import traceback, pdb
      # we are NOT in interactive mode, print the exception...
      traceback.print_exception(type, value, tb)
      print
      # ...then start the debugger in post-mortem mode.
      pdb.pm()

sys.excepthook = info
source : http://code.activestate.com/recipes/65287/
- simple logging 
import logging
logging.basicConfig(level=logging.DEBUG)
logging.debug('This is a debug message.')
source : http://aymanh.com/python-debugging-techniques#logging