Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I add logging to my stash plugin

Hello,

I'm trying to write my first Stash plugin (implementing a PreRecieveHook). I have a bug in the plugin, and would like to add some logging (which would be nice to have anyway). However, I cannot see how to do this. I've seen several questions/answers on more complex logging requirements (separate files for plugin etc), but I just need to output to the console / main logfile. Could anyone help with this?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted

You can use slf4j loggers like this:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class MyComponent {
    private static final Logger log = LoggerFactory.getLogger(MyComponent.class);
 
    public void myMethod() {
        ...
        log.info("Log a message here");
        ...
    }
}

By default INFO, WARN and ERROR log message should be enabled. If you want to see DEBUG and TRACE as well, you can customize the logging configuration through a custom logback.xml in your STASH_HOME directory or by adding stash-config.properties as described here: https://confluence.atlassian.com/display/STASH/Stash+debug+logging

TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you