Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,735
Community Members
 
Community Events
168
Community Groups

Tailing Log Files on Windows

As an administrator of all things Atlassian, I spend a fair amount of time stopping and starting Jira or Confluence, Bitbucket or Bamboo, whether during an upgrade or to address some configuration item that requires a restart. Coming from a Linux background, I regularly want to tail the log file to watch it as it starts up or to see the log in action when I am testing something.

For Linux users, this is natural; we have the 'tail' command with the "-f" option that will continuously output the log activity to our console. 

I have found that Windows administrators are less familiar with how to get a constant output from the log file. In my experience, Windows admins are more likely to open the log file in a text editor like Notepad++ to review it. This has two problems. First, these files can be very large, take a significant amount of time and memory to load, just so that you can scroll to the bottom to see the most recent updates. Second, you have to constantly reload if you want to see activity in the system.

There is a simple fix for this in Windows using PowerShell. PowerShell as the Get-Content (or gc) comment. The "-wait" option will keep the file open, streaming the contents to the terminal. The "-tail n" option (where n is a number) will show the last n lines of the file.

Since I am pretty lazy and like to use shortcuts whereever possible, I created the following PowerShell functions, which make it easy to quickly start tailing the jira or confluence logs:

function gcjira {
gc -wait -tail 1 "C:\Program Files\Atlassian\Application Data\JIRA\log\atlassian-jira.log"
}

function gcconf {
gc -wait -tail 1 "C:\Program Files\Atlassian\Application Data\Confluence\logs\atlassian-confluence.log"
}

Once you have run this script, all you need to do is type "gcjira" or "gcconf" to tail the appropriate log.

Since I work on lots of different systems, I keep this in a handy text file where I can copy/paste it into my PowerShell window.

Do you have any tips or tricks that you could share that make things easier for you as an Atlassian Administrator. Share them with us here.

1 comment

Very useful, thanks

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events