getting console output

Discussion in 'Plugin Development' started by robrobk, Jun 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    robrobk

    hi
    i am making a plugin that acts as a gui and i am having trouble getting all the console log

    this is what i have tried so far:


    This gets a few lines of console when starting the server.
    Code:java
    1.  
    2.  
    3. Handler h = new Handler() {
    4. @Override
    5. public void close() throws SecurityException {}
    6.  
    7. @Override
    8. public void flush() {}
    9.  
    10. @Override
    11. public void publish(LogRecord logRecord) {
    12. mainFrame.consolesg(logRecord.getLevel().toString(), logRecord.getMillis(), logRecord.getMessage());
    13. }
    14. };
    15. getServer().getLogger().addHandler(h);


    this only gets chat messages
    Code:java
    1.  
    2. /*this is in the onEnable*/
    3. System.setOut(new log(System.out, this));
    4.  
    5. /*this is the class "log"*/
    6. package tk.robk.bukkit.gui;
    7. import java.io.PrintStream;
    8. public class log extends PrintStream {
    9. private main pl;
    10. public log(PrintStream out, main parent) {
    11. super(out);
    12. pl = parent;
    13. }
    14. @Override public void print(String s) {
    15. pl.consolelog(s);
    16. }
    17. }


    i need to capture everything that you can see when you look at the actual console
     
  2. Offline

    NoLiver92

    robrobk Is this just an inteface to a console?
     
  3. Offline

    robrobk

  4. Offline

    RawCode

    post complete source with import section and log as text (not image)
     
  5. Offline

    NoLiver92


    Nice idea but im just gonna say, most servers these days are run on hosts. That being so alot of users will not be able to see your GUI (I found this problem out when I made a GUI logger for a server - in my plugin list). There would only be a small amount of people who could actually use this.

    It might be better for you to create a java program seperate and connect them using sockets, this would allow remote connection and would mean that owners can see their server GUI even if they are with a host (yes the host would have to open another port for them to use).

    Just thought I would add this to help your project :p

    EDIT: why not just read the file? and then check if new lines are added, like every 5 seconds, then add them to the GUI
     
  6. Offline

    robrobk

    the only reason im making this is because I want it for my server. i dont care about some random person who cant be bothered running their own server


    btw good idea with reading the log file
     
  7. Offline

    NoLiver92


    Fair enough :) I was just pointing out a problem which I encountered when I did my plugin, but if its just for your sever not a problem :)

    This is a very interesting plugin and I would love to see it when its done!!
     
  8. robrobk Be bothered as in home hosted or like a VPS/dedicated sort of setup? :confused:
     
  9. Offline

    robrobk

    home hosted
    its a server for me and a few friends so i can take it to school as well
     
  10. robrobk In that case, why do you assume that people who don't have gui access "can't be bothered"? :S
     
Thread Status:
Not open for further replies.

Share This Page