PDA

View Full Version : How can I set up an error log?



Beepa
20th May 2006, 02:46 AM
I would like to find out what all the errors I keep getting when I log off with both my root and other user accounts are. but there's more than fit on one screen. A bunch of OggS:Seek dadadad and Major 19 dada and Bad window dadada. Obviously (as is evidenced by the dadadas!) I could sorely use a log that tracked those errors. I'm pretty much a newbie with this Fedora Core 4 installation and if there is already a log set up for that I don't know its location or name? If someone might help me with this it would be much appreciated. So I can see what all my other problems are?? :eek:

u-noneinc-s
20th May 2006, 03:50 AM
You can view most logs in /var/log. I'm not sure which log you are looking for though. Maybe error_log or messages.
In a terminal, type system-log-viewer and you should get a gui you can customise to your liking.

EDIT There was a boot.log in FC3 which is prabably what you wanted, but it's gone from FC5 and I think it's
gone from FC4. It tracked startup AND shutdown.

Beepa
20th May 2006, 06:24 AM
Well is there a way to create a log that would track the errors at logoff? I looked for boot logs, error logs, I haven't found anything as of yet?? I tried "system-log-viewer" it says it's not a command. I'm running bash, KDE gui in Fedora Core 4 installation. I'm going to try yumex and see if I can see anything in the repositories. I am getting so many errors I can't see em all? Everything seems to run fine inside, just alot of erros loggin out?? :confused: :confused: :confused:

u-noneinc-s
20th May 2006, 06:32 AM
Sorry about that. It's system-logviewer (if it's installed). There was a post about restoring the boot.log, I'll post it if I can dig it
up, but I don't know how helpful it will be.
Like I said, most logs are in /var/log. root permission may be required for most (if not all).

u-noneinc-s
20th May 2006, 06:47 AM
I have a thread and a how to. here is the thread
http://forums.fedoraforum.org/forum/showthread.php?t=108626&highlight=boot+log

I don't remember exactly where I got the how to but it could be from this thread or the bug report listed in the thread or
maybe from another thread. I was looking for it because i was getting a lot of errors on boot up and shut
down after a selinux update, but another update a couple days later fixed the problem so I never got around
to trying it.

1. Change the chkconfig line in /etc/init.d/syslog to be :
'# chkconfig: 2345 0 99
'
and do:
# chkconfig --del syslog; chkconfig --add syslog

2. # cp -fp /usr/bin/logger /sbin

3. Edit /etc/init.d/functions to read, @line 367:
# Log that something succeeded
success() {
logger -p local7.info "$1"
...

# Log that something failed
failure() {
rc=$?
logger -p local7.info "$1"
...

Skunk Worx
20th May 2006, 06:50 AM
Well is there a way to create a log that would track the errors at logoff?

Assuming the application always logs errors while it is running, which is a good bet, you should be able to go look at the logs anytime you want.

Become root and open "/var/log/messages". The bottom of the file has the newest messages.

You can also watch them with tail in an xterm :


# tail -f /var/log/messages

...it's important to note that the use of logging is entirely dependent on the people who wrote the application.

If this is an application you can run from the command line, and you want to save the messages for later, you can do this in bash (once again, an xterm) like this :


$ my_moisy_application > /tmp/msgs.txt 2>&1

...which will save both stdout and stderr messages to the file "/tmp/msgs.txt" so you can look at them later.

---
John

Beepa
20th May 2006, 06:17 PM
Sorry about my lack of understanding, I have a few questions about the directions you gave me? :confused:
I have edited the your copied message to indicate where I'm confused. :confused:

I have a thread and a how to. here is the thread
http://forums.fedoraforum.org/forum/showthread.php?t=108626&highlight=boot+log

I don't remember exactly where I got the how to but it could be from this thread or the bug report listed in the thread or
maybe from another thread. I was looking for it because i was getting a lot of errors on boot up and shut
down after a selinux update, but another update a couple days later fixed the problem so I never got around
to trying it.
(when I change the chkconfig line here -> are the single quotes part of what I type? And also is "and do:" part of the script or are you telling me to do the things following in the # commented line at the command line? Or are the lines I've marked in red 1 - 4 all part of the code change in /etc/init.d/syslog ??)

1. Change the chkconfig line in /etc/init.d/syslog to be :
1 '# chkconfig: 2345 0 99
2 '
3 and do:
4 # chkconfig --del syslog; chkconfig --add syslog

(I am assuming #2 is a command line to copy /usr/bin/logger to /sbin?)
2. # cp -fp /usr/bin/logger /sbin

(Here I've numbered the lines I am thinking actually go in /etc/init.d/functions at the
specified line 367.)
3. Edit /etc/init.d/functions to read, @line 367:
1 # Log that something succeeded
2 success() {
3 logger -p local7.info "$1"
leaving these out
...
4 # Log that something failed
5 failure() {
6 rc=$?
7 logger -p local7.info "$1"
leaving these dots out too
...
I can be pretty dense at times! Again, I apologize for needing the clarification! I do appreciate all the time you have spent on several of my topics. :cool:

Beepa
20th May 2006, 06:35 PM
I thank you for the info. I had not looked in the messages file though I had been going through the files that were marked as logs in there. (Sometimes its just not working upstairs!) But I did go through every file in /var/logs now, and none show the error messages I get when I log in and out?
I did at one time learn that redirection technique for error msgs and had forgotten it so thank you for reminding me of that as well. Always a good one to remember. :)

u-noneinc-s
20th May 2006, 07:21 PM
Sorry about my lack of understanding, I have a few questions about the directions you gave me?
I have edited the your copied message to indicate where I'm confused.

(I am assuming #2 is a command line to copy /usr/bin/logger to /sbin?)
2. # cp -fp /usr/bin/logger /sbin
As I said, another selinux update fixed my problem so I never got around to using this, but YES, this is a
command to copy "logger" to /sbin.
(Here I've numbered the lines I am thinking actually go in /etc/init.d/functions at the
specified line 367.)
3. Edit /etc/init.d/functions to read, @line 367:
1 # Log that something succeeded
2 success() {
3 logger -p local7.info "$1"
leaving these out
...
4 # Log that something failed
5 failure() {
6 rc=$?
7 logger -p local7.info "$1"
leaving these dots out too
Again, I would agree, but now that I look at it, I believe I looked into this when I first found it and I don't
believe the line numbers corresponded from what it says here, and what it actually said in MY init (though I
don't really know anything about scripts, so perhaps this is referring to a section of the script that "begins"
or "ends" at that line number(?). and, mine was an FC3 box which could explain the difference in line numbers.

I do like Skunk Worx's approach, but I don't know how you would impliment it at startup/shutdown. (I pointed you
to the "defunct" boot.log because that covered both startup and shutdown). Perhaps Skunk Worx will
will tell you how to do it commandline. Would this work? <shutdown or reboot > /tmp/msgs.txt 2>&1> or some variation?

Skunk Worx
20th May 2006, 07:41 PM
AFAIK an application must support logging to get log messages, that is, when designed/programmed they had to put the syslog calls in the application. Sometimes they need to be turned on with a debug flag, and sometimes you need to enable them by editing the /etc/syslog.conf file.

Usually if you can see messages via the "dmesg" command, you will see them in /var/log/messages as well.

That being said, a lot of applications simply send messages to stdout or stderr.

For X session problems, edit /etc/inittab to go into runlevel 3, then use "startx". Any X related error messages will go to the console (ctrl-alt-f1). After shutting down, the shutdown messages will be there as well.

I don't know of any global way to tell Fedora, UNIX, or Linux to grab every stderr msg sent through the system and put it in a log.

Often individual daemons have a flag you can set to enable logging...typically you would do this in the /etc/rc.d script that starts the daemon.

That's my take anyway...

Beepa
21st May 2006, 03:54 AM
You didn't address the questions I was asking about the code you posted? I would like to try the method you suggested but I just want to make sure I understand what you were telling me?? That method Skunk is referring to doesn't give me an option for loggin in and out. I am at start lvl 3 and it is when I log off of either one of the users I have set up that I get the long list of error messages. Using Ctrl+Alt+F1 did take me to the console! In fact it abrubtly shut down X and I couldn't do anything like copy or scroll so basically it didn't do much more than loggin off as far as seeing the messages.
Also using Ctrl+Alt+F1 was not liked by my system anyway! :eek: Had lots of panic'd responses to that. :eek:
Anyway in your response I was hoping you would clarify the questions I posed in my comments about your code but the only one you commented on was line (2) and you didn't include anything about the 1st bit of code you suggested for changing lines in /etc/init.d/syslog?? Those were the most confusing to me and I was just clarifying the rest so if I was making a mistake in reading you could let me know? Maybe you would go back over the code and my edit remarks that I put in colors and clarify for me what I actually need to enter into those files. :confused: Again I thank you for all the time you have taken with my posts lately. :)

Beepa
21st May 2006, 04:04 AM
I checked your previous posts and didn't see where you had mentioned that before?? How do I use that command to see errors?? If you read my post to u-noneinc-s you know that I tried using Ctrl+Alt+F1 and it did bring me to the console with the same or similar messages but it was accompanied by kill messages and other alerts for leaving X abrutbtly I'm guessing? Took me awhile to figure out how to get back in. :confused: I wasn't able to copy any of the messages and I couldn't scroll to get the full context of the errors which is my intent. I think picking up the tail end of the errors is probably not going to help much but I'm not even sure of that. If I can't find a way to log them I'll have to just write down the ones I can see and try to go from there. I saw a dmesg file in /var/log but it was some sort of executable and not readable. So I'm curious now about how to use that command if you don't mind explaining that to me? :D Thank you again for your time. :)

u-noneinc-s
21st May 2006, 04:18 AM
Actually, I did answer both your questions, but my second answer was probably misleading. When I said
Again, I would agree, but now that I look at it, I believe I looked into this when I first found it and I don't
believe the line numbers corresponded from what it says here, and what it actually said in MY init (though I
don't really know anything about scripts, so perhaps this is referring to a section of the script that "begins"
or "ends" at that line number(?). and, mine was an FC3 box which could explain the difference in line numbers.
What I meant was "yes, I think you have interpreted correctly." To the best of my knowledge, the answere to
BOTH questions is yes. Keep in mind though I am not that knowledgeable, and I know less about scripts.

Make a backup before you edit anything (always).

I don't know why the boot log was eliminated. They say you can find any errors in dmesg or messages or in
the relative "failed" service logfiless (http/apache, secure, error_log, mail, etc) but I NEVER found any of the
errors I was seeing at the time.

u-noneinc-s
21st May 2006, 04:24 AM
In a terminal, type
dmesg |more

Skunk Worx
21st May 2006, 06:38 AM
ctrl-alt-f1 goes to the console
ctrl-alt-f7 goes back to X

sorry i've been doing it so long i forgot some people might not know how to get back.

---
John

Beepa
21st May 2006, 07:04 AM
1. Change the chkconfig line in /etc/init.d/syslog to be :
1) '# chkconfig: 2345 0 99
2) '
3) and do:
4) # chkconfig --del syslog; chkconfig --add syslog

I numbered in red the lines as a reference to what you wrote.
so does line 1 get written with the single quote or is the single quote what you were using to show the statement?
is line 2 (the single quote) a line or again is it just misplaced?

is line 3 a line to enter into the /etc/init.d/syslog file or is it just a lead in to line 4 being read as command line statements??
is line 4 part of the code to enter into /etc/init.d/syslog or are you showing me 2 command line statements to run after I change the file with the first line??.
And btw I tried running chkconfig at command prompt and it says its not a command even though I'm su'd?
:confused: :confused:

Skunk Worx
21st May 2006, 07:19 AM
use "su -" to actually read the root user's environment. "su" leaves you with your user environment which does not have "/sbin" in the default path.

---
John

u-noneinc-s
21st May 2006, 07:06 PM
I am sorry Beepa. I don't know how I overlooked that part of your question. It was staring me right in the face in red letters.
I am also sorry to say I don't know the answer to 1 and 2 since 1 has a # which usually means a comment. However, in
this case I believe the #'s are there to seperate the code and commands for the text of the how-to.
Look at your /etc/init.d/syslog and look at the chkconfig line. Is it commented out? If it's not commented out, does it have the
single quote before it and after it (on the next line)? If it's not commented out and it doesn't have the quotes, and if the
numbers are diffetent, I would suggest changing the numbers to match those in the how-to and try it (without
the # and ').

Now for the next part. After editing /etc/init.d/syslog, I believe these are commands to delete the old and add the new
syslogd , so, without the # the first command chkconfig --del syslog then the next command would be
chkconfig --add syslog

I can't stress enough, back up syslogd first. Then try combinations of 1 above. chkconfig: 2345 0 99 (This is what I think
needs to be there) # chkconfig: 2345 0 99 (this would be my second guess and
'# chkconfig: 2345 0 99
'
(would be my last guess, though I don't think it is very likely).

I am sorry I can't be more helpful. I only found this script on the forum or through the bug report or additionl google
searches. I wish I could point you directly to the link i found it at.

Beepa
21st May 2006, 08:48 PM
That was exactly what I was looking for and not to worry I back up all the files I change. I learned that the hard way of course! I already made a copy and called it syslog.old. I will play around with it today and see what I can get going. I'll keep you updated :) Hope I haven't been too much of a pest! :D

Beepa
21st May 2006, 08:51 PM
I actually never knew about su - versus su. Thank you for that tip it will save me a lot of relogging! :) :)