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

            How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229