如何抑制SBT的调试信息?它们被记录到stdout,因此运行一个项目产生了这个:
$ cat src/main/scala/Hello.scala
object Hello {
def main(args: Array[String]) {
Console.println("Hello sbt")
}
}
$ sbt run > out.txt
$ cat out.txt
[info] Set current project to hello (in build file:/home/synapse/projects/algs2/)
[info] Running Hello
Hello sbt
[success] Total time: 1 s, completed May 14, 2013 11:39:23 PM
答案 0 :(得分:8)
正如this reference中提到的另一个答案所链接的那样,可以在到达sbt控制台之前更改日志记录级别。
"要在启动时执行任何命令之前设置日志记录级别,请在日志记录级别之前使用public void createTables(SQLiteDatabase database) {
String subscriber_table_sql = "create table " + Database.SUBSCRIBE_TABLE_NAME + " ( " +
Database.SUBSCRIBE_ID + " integer primary key autoincrement," +
Database.SUBSCRIBE_NAME + " TEXT," +
Database.SUBSCRIBE_PHONE + " TEXT," +
Database.SUBSCRIBE_DEVICEID + " TEXT," +
Database.SUBSCRIBE_AREA + " TEXT," +
Database.SUBSCRIBE_CITY + " TEXT)";
String friends_table_sql = "create table " + Database.FRIENDS_TABLE_NAME + " ( " +
Database.FRIENDS_ID + " integer primary key autoincrement," +
Database.FRIENDS_NAME + " TEXT," +
Database.FRIENDS_PHONE + " TEXT," +
Database.FRIENDS_AREA+ " TEXT," +
Database.FRIENDS_CITY + " TEXT)";
。"
例如
--
但是,您仍然会在最后记录$ sbt --error "runMain my.pckg.Main"
消息。为了使其沉默,请考虑使用[success]
。
答案 1 :(得分:2)
您可以按照here所述更改日志记录级别。因此,您可以将日志记录级别更改为Warn
:
> run
[info] Running Server
Port is: null
Embedded server running on port 8080. Press any key to stop.
[success] Total time: 3 s, completed 14-May-2013 21:02:31
>
> set logLevel in run := Level.Warn
...
[info] Reapplying settings...
[info] Set current project to server (in build file:/Users/me/myproject/)
> run
Port is: null
Embedded server running on port 8080. Press any key to stop.
并且您不再获取为run
命令打印的信息消息。您可以将该设置添加到构建文件中,以使其永久化。
答案 2 :(得分:0)
您可以将“日志级别”属性添加到“全局SBT”属性。 这适用于sbt版本1.x
档案:$result = DB::table('fixtures')
->join('games', 'fixtures.homeId', '=', 'games.dataId')
->select(DB::raw('fixtures.id','fixtures.homeId','fixtures.awayId','games.name','games.id'))
->where('games.parent', null)
->get();
return($result);
~/.sbt/1.0/global.sbt