Export Tomcat Catalina Logs to external serverTomcat Servlet not showing Log outDifference between the Apache HTTP Server and Apache Tomcat?How to configure Tomcat JULI logging to roll log files?How to have git log show filenames like svn log -vJSF2 logs with tomcatException when running Tomcat server org.apache.catalina.deploy.WebXml addServletTomcat System.out redirectionHow to install ssl in Tomcat 7 - Amazon ec2 ubuntu instanceTomcat logging stops (pauses) soon after initializationHide strange unwanted Xcode logsHow can I disable juli logging in tomcat 8?

Can I sign legal documents with a smiley face?

Should I install hardwood flooring or cabinets first?

Why did the HMS Bounty go back to a time when whales are already rare?

My friend sent me a screenshot of a transaction hash, but when I search for it I find divergent data. What happened?

Do the concepts of IP address and network interface not belong to the same layer?

Did US corporations pay demonstrators in the German demonstrations against article 13?

Is a model fitted to data or is data fitted to a model?

Freedom of speech and where it applies

Why is Arduino resetting while driving motors?

Will adding a BY-SA image to a blog post make the entire post BY-SA?

What (else) happened July 1st 1858 in London?

Global amount of publications over time

Has Darkwing Duck ever met Scrooge McDuck?

Is XSS in canonical link possible?

Open a doc from terminal, but not by its name

How much character growth crosses the line into breaking the character

Greco-Roman egalitarianism

When quoting, must I also copy hyphens used to divide words that continue on the next line?

Why does Async/Await work properly when the loop is inside the async function and not the other way around?

Flux received by a negative charge

Should I stop contributing to retirement accounts?

Hot bath for aluminium engine block and heads

How will losing mobility of one hand affect my career as a programmer?

Can we have a perfect cadence in a minor key?



Export Tomcat Catalina Logs to external server


Tomcat Servlet not showing Log outDifference between the Apache HTTP Server and Apache Tomcat?How to configure Tomcat JULI logging to roll log files?How to have git log show filenames like svn log -vJSF2 logs with tomcatException when running Tomcat server org.apache.catalina.deploy.WebXml addServletTomcat System.out redirectionHow to install ssl in Tomcat 7 - Amazon ec2 ubuntu instanceTomcat logging stops (pauses) soon after initializationHide strange unwanted Xcode logsHow can I disable juli logging in tomcat 8?













0















I am using Tomcat 7.x as my web server and I am using java.util.logging and JULI for logging. This Tomcat server is hosted an Amazon EC2 instance which runs Ubuntu.



The Problem is whenever I wish to see the logs (in catalina.log file) I have go through a very time consuming process of copying, chowing and then downloading the files to my local machine before I can see them. (I can use utilities like nano or vi but they do not help much)



My Question Can I automatically exports the logs to some external server and view them straight away. Some thing similar to Bugsense for ACRA reports in Android.










share|improve this question






















  • it is much more convenient to use less command to view logs files. Even more convenient than notepad or something similar. You just need to used to. Everything you need: scroll page up/down, scroll cursor and search

    – Anton
    Nov 22 '12 at 20:13
















0















I am using Tomcat 7.x as my web server and I am using java.util.logging and JULI for logging. This Tomcat server is hosted an Amazon EC2 instance which runs Ubuntu.



The Problem is whenever I wish to see the logs (in catalina.log file) I have go through a very time consuming process of copying, chowing and then downloading the files to my local machine before I can see them. (I can use utilities like nano or vi but they do not help much)



My Question Can I automatically exports the logs to some external server and view them straight away. Some thing similar to Bugsense for ACRA reports in Android.










share|improve this question






















  • it is much more convenient to use less command to view logs files. Even more convenient than notepad or something similar. You just need to used to. Everything you need: scroll page up/down, scroll cursor and search

    – Anton
    Nov 22 '12 at 20:13














0












0








0








I am using Tomcat 7.x as my web server and I am using java.util.logging and JULI for logging. This Tomcat server is hosted an Amazon EC2 instance which runs Ubuntu.



The Problem is whenever I wish to see the logs (in catalina.log file) I have go through a very time consuming process of copying, chowing and then downloading the files to my local machine before I can see them. (I can use utilities like nano or vi but they do not help much)



My Question Can I automatically exports the logs to some external server and view them straight away. Some thing similar to Bugsense for ACRA reports in Android.










share|improve this question














I am using Tomcat 7.x as my web server and I am using java.util.logging and JULI for logging. This Tomcat server is hosted an Amazon EC2 instance which runs Ubuntu.



The Problem is whenever I wish to see the logs (in catalina.log file) I have go through a very time consuming process of copying, chowing and then downloading the files to my local machine before I can see them. (I can use utilities like nano or vi but they do not help much)



My Question Can I automatically exports the logs to some external server and view them straight away. Some thing similar to Bugsense for ACRA reports in Android.







java android tomcat logging






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '12 at 19:41









Gaurav AgarwalGaurav Agarwal

8,4012690148




8,4012690148












  • it is much more convenient to use less command to view logs files. Even more convenient than notepad or something similar. You just need to used to. Everything you need: scroll page up/down, scroll cursor and search

    – Anton
    Nov 22 '12 at 20:13


















  • it is much more convenient to use less command to view logs files. Even more convenient than notepad or something similar. You just need to used to. Everything you need: scroll page up/down, scroll cursor and search

    – Anton
    Nov 22 '12 at 20:13

















it is much more convenient to use less command to view logs files. Even more convenient than notepad or something similar. You just need to used to. Everything you need: scroll page up/down, scroll cursor and search

– Anton
Nov 22 '12 at 20:13






it is much more convenient to use less command to view logs files. Even more convenient than notepad or something similar. You just need to used to. Everything you need: scroll page up/down, scroll cursor and search

– Anton
Nov 22 '12 at 20:13













3 Answers
3






active

oldest

votes


















2














You could create a servlet to run in Tomcat to read the logs and display them in your web browser. Or if the file is large, zip it up and allow you to download it.



Use the environment variable catalina.base to determine the base directory and then gather up logs/catalina.log.



[update]



The best approach would depend on your background. If you are comfortable doing a basic, no-frills servlet, start with the simplest design that could possibly work such as:



class LogServlet extends HttpServlet

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException

File logFile = new File(System.getProperty("catalina.base"), "logs/catalina.log");
String contents = FileUtils.readFileToString(logFile);
PrintWriter out = new PrintWriter(resp.getOutputStream());
out.println(contents);




I am using commons-io to simplify reading the log file, but otherwise it's just the Java servlet framework.






share|improve this answer

























  • +1, Idea seems workable to me, any libraries, blog or suggestion how to go about doing it.

    – Gaurav Agarwal
    Nov 22 '12 at 20:45











  • See update. We used the servlet approach above to do something similar.

    – Guido Simone
    Nov 22 '12 at 21:05











  • I will implement it. Any suggested libraries.

    – Gaurav Agarwal
    Nov 22 '12 at 21:22











  • Just Apache commons-io.

    – Guido Simone
    Nov 22 '12 at 21:24











  • Ok, I will keep this question open for one more days looking for other contributors.

    – Gaurav Agarwal
    Nov 22 '12 at 21:33


















0














rsync then periodically use a cron job on the server you want or use some tool like collectd.






share|improve this answer
































    0














    You could use logstash or fluentd to stream the logs and load into your prefered target, say Elastic Search. You could visualize or search through the logs from elasticsearch using visualization tools like Kibana or Graylog






    share|improve this answer























    • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker.

      – Tiw
      Mar 8 at 6:57










    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f13519115%2fexport-tomcat-catalina-logs-to-external-server%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    You could create a servlet to run in Tomcat to read the logs and display them in your web browser. Or if the file is large, zip it up and allow you to download it.



    Use the environment variable catalina.base to determine the base directory and then gather up logs/catalina.log.



    [update]



    The best approach would depend on your background. If you are comfortable doing a basic, no-frills servlet, start with the simplest design that could possibly work such as:



    class LogServlet extends HttpServlet

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException

    File logFile = new File(System.getProperty("catalina.base"), "logs/catalina.log");
    String contents = FileUtils.readFileToString(logFile);
    PrintWriter out = new PrintWriter(resp.getOutputStream());
    out.println(contents);




    I am using commons-io to simplify reading the log file, but otherwise it's just the Java servlet framework.






    share|improve this answer

























    • +1, Idea seems workable to me, any libraries, blog or suggestion how to go about doing it.

      – Gaurav Agarwal
      Nov 22 '12 at 20:45











    • See update. We used the servlet approach above to do something similar.

      – Guido Simone
      Nov 22 '12 at 21:05











    • I will implement it. Any suggested libraries.

      – Gaurav Agarwal
      Nov 22 '12 at 21:22











    • Just Apache commons-io.

      – Guido Simone
      Nov 22 '12 at 21:24











    • Ok, I will keep this question open for one more days looking for other contributors.

      – Gaurav Agarwal
      Nov 22 '12 at 21:33















    2














    You could create a servlet to run in Tomcat to read the logs and display them in your web browser. Or if the file is large, zip it up and allow you to download it.



    Use the environment variable catalina.base to determine the base directory and then gather up logs/catalina.log.



    [update]



    The best approach would depend on your background. If you are comfortable doing a basic, no-frills servlet, start with the simplest design that could possibly work such as:



    class LogServlet extends HttpServlet

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException

    File logFile = new File(System.getProperty("catalina.base"), "logs/catalina.log");
    String contents = FileUtils.readFileToString(logFile);
    PrintWriter out = new PrintWriter(resp.getOutputStream());
    out.println(contents);




    I am using commons-io to simplify reading the log file, but otherwise it's just the Java servlet framework.






    share|improve this answer

























    • +1, Idea seems workable to me, any libraries, blog or suggestion how to go about doing it.

      – Gaurav Agarwal
      Nov 22 '12 at 20:45











    • See update. We used the servlet approach above to do something similar.

      – Guido Simone
      Nov 22 '12 at 21:05











    • I will implement it. Any suggested libraries.

      – Gaurav Agarwal
      Nov 22 '12 at 21:22











    • Just Apache commons-io.

      – Guido Simone
      Nov 22 '12 at 21:24











    • Ok, I will keep this question open for one more days looking for other contributors.

      – Gaurav Agarwal
      Nov 22 '12 at 21:33













    2












    2








    2







    You could create a servlet to run in Tomcat to read the logs and display them in your web browser. Or if the file is large, zip it up and allow you to download it.



    Use the environment variable catalina.base to determine the base directory and then gather up logs/catalina.log.



    [update]



    The best approach would depend on your background. If you are comfortable doing a basic, no-frills servlet, start with the simplest design that could possibly work such as:



    class LogServlet extends HttpServlet

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException

    File logFile = new File(System.getProperty("catalina.base"), "logs/catalina.log");
    String contents = FileUtils.readFileToString(logFile);
    PrintWriter out = new PrintWriter(resp.getOutputStream());
    out.println(contents);




    I am using commons-io to simplify reading the log file, but otherwise it's just the Java servlet framework.






    share|improve this answer















    You could create a servlet to run in Tomcat to read the logs and display them in your web browser. Or if the file is large, zip it up and allow you to download it.



    Use the environment variable catalina.base to determine the base directory and then gather up logs/catalina.log.



    [update]



    The best approach would depend on your background. If you are comfortable doing a basic, no-frills servlet, start with the simplest design that could possibly work such as:



    class LogServlet extends HttpServlet

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException

    File logFile = new File(System.getProperty("catalina.base"), "logs/catalina.log");
    String contents = FileUtils.readFileToString(logFile);
    PrintWriter out = new PrintWriter(resp.getOutputStream());
    out.println(contents);




    I am using commons-io to simplify reading the log file, but otherwise it's just the Java servlet framework.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 22 '12 at 21:03

























    answered Nov 22 '12 at 20:43









    Guido SimoneGuido Simone

    6,87721217




    6,87721217












    • +1, Idea seems workable to me, any libraries, blog or suggestion how to go about doing it.

      – Gaurav Agarwal
      Nov 22 '12 at 20:45











    • See update. We used the servlet approach above to do something similar.

      – Guido Simone
      Nov 22 '12 at 21:05











    • I will implement it. Any suggested libraries.

      – Gaurav Agarwal
      Nov 22 '12 at 21:22











    • Just Apache commons-io.

      – Guido Simone
      Nov 22 '12 at 21:24











    • Ok, I will keep this question open for one more days looking for other contributors.

      – Gaurav Agarwal
      Nov 22 '12 at 21:33

















    • +1, Idea seems workable to me, any libraries, blog or suggestion how to go about doing it.

      – Gaurav Agarwal
      Nov 22 '12 at 20:45











    • See update. We used the servlet approach above to do something similar.

      – Guido Simone
      Nov 22 '12 at 21:05











    • I will implement it. Any suggested libraries.

      – Gaurav Agarwal
      Nov 22 '12 at 21:22











    • Just Apache commons-io.

      – Guido Simone
      Nov 22 '12 at 21:24











    • Ok, I will keep this question open for one more days looking for other contributors.

      – Gaurav Agarwal
      Nov 22 '12 at 21:33
















    +1, Idea seems workable to me, any libraries, blog or suggestion how to go about doing it.

    – Gaurav Agarwal
    Nov 22 '12 at 20:45





    +1, Idea seems workable to me, any libraries, blog or suggestion how to go about doing it.

    – Gaurav Agarwal
    Nov 22 '12 at 20:45













    See update. We used the servlet approach above to do something similar.

    – Guido Simone
    Nov 22 '12 at 21:05





    See update. We used the servlet approach above to do something similar.

    – Guido Simone
    Nov 22 '12 at 21:05













    I will implement it. Any suggested libraries.

    – Gaurav Agarwal
    Nov 22 '12 at 21:22





    I will implement it. Any suggested libraries.

    – Gaurav Agarwal
    Nov 22 '12 at 21:22













    Just Apache commons-io.

    – Guido Simone
    Nov 22 '12 at 21:24





    Just Apache commons-io.

    – Guido Simone
    Nov 22 '12 at 21:24













    Ok, I will keep this question open for one more days looking for other contributors.

    – Gaurav Agarwal
    Nov 22 '12 at 21:33





    Ok, I will keep this question open for one more days looking for other contributors.

    – Gaurav Agarwal
    Nov 22 '12 at 21:33













    0














    rsync then periodically use a cron job on the server you want or use some tool like collectd.






    share|improve this answer





























      0














      rsync then periodically use a cron job on the server you want or use some tool like collectd.






      share|improve this answer



























        0












        0








        0







        rsync then periodically use a cron job on the server you want or use some tool like collectd.






        share|improve this answer















        rsync then periodically use a cron job on the server you want or use some tool like collectd.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 22 '12 at 20:10









        Chris Seymour

        62.9k20125162




        62.9k20125162










        answered Nov 22 '12 at 19:51









        xeyexeye

        1,042813




        1,042813





















            0














            You could use logstash or fluentd to stream the logs and load into your prefered target, say Elastic Search. You could visualize or search through the logs from elasticsearch using visualization tools like Kibana or Graylog






            share|improve this answer























            • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker.

              – Tiw
              Mar 8 at 6:57















            0














            You could use logstash or fluentd to stream the logs and load into your prefered target, say Elastic Search. You could visualize or search through the logs from elasticsearch using visualization tools like Kibana or Graylog






            share|improve this answer























            • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker.

              – Tiw
              Mar 8 at 6:57













            0












            0








            0







            You could use logstash or fluentd to stream the logs and load into your prefered target, say Elastic Search. You could visualize or search through the logs from elasticsearch using visualization tools like Kibana or Graylog






            share|improve this answer













            You could use logstash or fluentd to stream the logs and load into your prefered target, say Elastic Search. You could visualize or search through the logs from elasticsearch using visualization tools like Kibana or Graylog







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 8 at 6:21









            Ranjith MRKRanjith MRK

            13




            13












            • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker.

              – Tiw
              Mar 8 at 6:57

















            • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker.

              – Tiw
              Mar 8 at 6:57
















            This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker.

            – Tiw
            Mar 8 at 6:57





            This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker.

            – Tiw
            Mar 8 at 6:57

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid …


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f13519115%2fexport-tomcat-catalina-logs-to-external-server%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Posting a File and Associated Data to a RESTful WebService preferably as JSON2019 Community Moderator ElectionREST URI convention - Singular or plural name of resource while creating itUploading both data and files in one form using Ajax?How do I upload a file with metadata using a REST web service?REST API - file (ie images) processing - best practicesSpring: JSON data and file in the same requestREST API Put large dataPosting a file and JSON data to Spring rest serviceRESTful Web Service Upload/Download Large Data With JSONREST API Design sending JSON data and a file to the api in same requestPost JSONArray to REST servicePUT vs. POST in RESTParsing values from a JSON file?JavaScript/jQuery to download file via POST with JSON dataHow do I upload a file with metadata using a REST web service?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?Separate REST JSON API server and client?what's the correct way to send a file from REST web service to client?How do I write JSON data to a file?What is “406-Not Acceptable Response” in HTTP?REST API - file (ie images) processing - best practices

            How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page