Listener Log

Where is Oracle Listener Log Location

The Default Location of Oracle Listener Log

If you have read Where to Find Oracle Alert Log Location, you may have some clues to find the right listener.log. But there’re some differences between them.

For 11g and above

The default location of listener log for 11g or above can be found at: [oracle@ora11g ~]$ ll $ORACLE_BASE/diag/tnslsnr/$(hostname -s)/listener/trace/listener.log
-rw-r-----. 1 oracle oinstall 477708 Apr 18 18:25 /u01/app/oracle/diag/tnslsnr/ora11g/listener/trace/listener.log

As you can see in the path, the listener log follows the hostname, whereas the alert log location of database follows the database name (db_name). All paths follow the directory structure of diagnostic repository. That’s the difference.

Another way to check the listener log location is to use lsnrctl command: [oracle@ora11g ~]$ lsnrctl status
...
Listener Log File         /u01/app/oracle/diag/tnslsnr/ora11g/listener/alert/log.xml
...

The listed file is a XML-versioned listener.log. Basically, it’s not what we are looking for, but they are the same thing essentially.

For 9i and 10g

The default path of the listener log for 9i and 10g is somewhat different: [oracle@ora9i ~]$ ll $ORACLE_HOME/network/log/listener.log
-rw-r--r--  1 oracle oinstall 117307 Apr 18 14:26 /u01/app/oracle/product/9.2.0/network/log/listener.log

Eventually, it’s in $ORACLE_HOME.

Also, we can use lsnrctl to list the listener log location. [oracle@ora9i ~]$ lsnrctl status
...
Listener Log File         /u01/app/oracle/product/9.2.0/network/log/listener.log
...

It’s the same file.

Find the Location of Oracle Listener Log by OS Commands

In case that the listener log is nowhere to be found, you can still use OS commands to find it.

Using Find Command

Almost all UNIX and Linux support find command, so using it to find some files is a very common way to do it.

[oracle@ora11g ~]$ find $ORACLE_BASE -type f -name listener.log
/u01/app/oracle/diag/tnslsnr/ora11g/listener/trace/listener.log
/u01/app/oracle/product/11.2.0/dbhome_1/listener.log

The first file is the right file that we’re looking for. The second file is not.

Using Locate Command

Sometimes, using locate command will be faster than find.

[oracle@ora11g ~]$ locate listener.log
/u01/app/oracle/diag/tnslsnr/ora11g/listener/trace/listener.log
/u01/app/oracle/product/11.2.0/dbhome_1/listener.log

The result of locate is the same as the result of find, but it’s faster.

Leave a Reply

Your email address will not be published. Required fields are marked *