Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

chaos_cat's scratchpad

by chaos_cat (Scribe)
on Jan 07, 2008 at 21:46 UTC ( #660949=scratchpad: print w/replies, xml ) Need Help??

# To make Log4perl not crash your application if your logging director +y doesn't exist, include something like this in a wrapper file. INIT: while ( !$init_done ) { $init_done = eval { Log::Log4perl->init($conf_file_name); 1; }; if ($@) { warn "Logger error was: $@"; # Config file error of some kind # Send some alert message here, somehow # if we get a missing directory error, try some (sane) recover +y # error message looks like: # Can't open <PATH> (No such file or directory) at perl/site/l +ib/Log/Log4perl/Appender/File.pm line 102. if ( $@ =~ m{Can't\sopen\s$base_path(.+)/[^/]+\s\(No such file + or directory\)} ) { my $path = $1; $path = $base_path . $path; # if the base path isn't th +ere, creating it is above this module's pay grade warn "log directory $path does not exist, attempting to cr +eate it"; if ( $paths{$path}++ ) { # only try once to create a + given path. This prevents infinite loops here warn "alredy tried to create this path"; last INIT; } eval { mkpath($path) }; warn "unable to create path $path" if ( !-d $path ); } # for other config file errors, throw our hands up in disgust +and move on else { last INIT; } } }# if we couldn't get the config file to initlize, load a blank one an +d move on without logging if ( ! $init_done ) { warn "Couldn't initilize logger, defaulting to blank config file"; Log::Log4perl::init(\''); # this will throw a warning, but that's +not really a bad thing }
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Corion]: My Android phone also has /proc/self/ loginuid, but that displays -1 (resp. 4GB). That might be because the phone is rooted.
[tye]: -1 means nobody logged in or the process was started before audit got booted
[davido]: ok, on my ubuntu system getlogin grabs from /proc/self/ loginuid (per strace)
[tye]: disable /proc and then see what it does?
[davido]: then it reads from /etc/passwd to decide who my uid is.
[davido]: sorry, typed that before you asked me to disable proc
[davido]: but you stumped me; don't know how to disable proc.
[tye]: I don't know if you can just dismount, but I thought so.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-06-23 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (554 votes). Check out past polls.