How to use the org.apache.mesos.Log?

333 views Asked by At

I want to get the mesos logs by org.apache.mesos.Log , but the API is too little about it. I don't know How to use the "Writer" and the "Reader". When I create a new Log, there are some files created, but I don't even know what does it mean. Is there any one who had ever used it?

this is my code

public class MyMesosLog {


  private static org.apache.mesos.Log log;

  private static Log getLog(){
    return log == null ? new Log(2,"/Users/wangyao/Desktop","localhost:2181",2000, TimeUnit.MILLISECONDS,"mesos") : log;
  }

  private static Log.Writer getWriter(){
    return new Log.Writer(log,2000,TimeUnit.MILLISECONDS,5);
  }

  private static Log.Reader getReader(){
    return new Log.Reader(log);
  }

  public static void main(String[] args){
    MyMesosLog.getLog();
  }

}

the result is: just 5 files created on my desktop, There is nothing in these files except a file named Log, that is the information:

2015/06/10-14:14:14.688716 1019f3000 Recovering log #12
2015/06/10-14:14:14.691651 1019f3000 Delete type=0 #12
2015/06/10-14:14:14.691729 1019f3000 Delete type=3 #10
2015/06/10-14:14:14.693408 1211e4000 Level-0 table #17: started
2015/06/10-14:14:14.693583 1211e4000 Level-0 table #17: 0 bytes OK
2015/06/10-14:14:14.694033 1211e4000 Delete type=0 #15
2015/06/10-14:14:14.694285 1211e4000 Manual compaction at level-0 from (begin) .. (end); will stop at (end)

The result I want to get is like in this Mesos url : http://localhost:5050/#/ I can find the logs of task, for example :Launcher.log ,stderr and stdout

2

There are 2 answers

0
drexin On BEST ANSWER

The Logis not about accessing log messages, but about storing data in Mesos own replicated log (a distributed data storage).

see also: http://mesos.apache.org/blog/mesos-0-17-0-released-featuring-autorecovery/

0
Adam On

To access the task logs, you could use the mesos-cli tools:

and use mesos tail and mesos cat to get logs for your tasks.

If you're using Mesosphere's Marathon and/or DCOS, you could also try: