ERROR StatusLogger No log4j2 configuration file found [reactivemongo 0.11.7]

759 views
Skip to first unread message

Павел Хандрамай

unread,
Sep 9, 2015, 7:57:22 AM9/9/15
to ReactiveMongo - http://reactivemongo.org
I have created a reactivemongo simple app.

import reactivemongo.api.{BSONSerializationPack, MongoDriver}
import reactivemongo.api.commands.Command
import reactivemongo.bson.{BSONArray, BSONDocument}

import scala.concurrent.ExecutionContext.Implicits.global

object TestMongo extends App {

 
val driver = new MongoDriver
 
val servers = List("localhost:27017")
 
val connection = driver.connection(servers)
 
val db = connection.db("test")

 
val command = BSONDocument(
   
"aggregate" -> "test",
    "pipeline" -> BSONArray(
     
BSONDocument("$match" -> BSONDocument("foo" -> "bar"))
   
)
 
)
 
val runner = Command.run(BSONSerializationPack)
 
runner.apply(db, runner.rawCommand(command)).one[BSONDocument].map(b => println(BSONDocument.pretty(b))).recover {
   
case e: Exception => println(e.printStackTrace())
 
}

}

build.sbt
name := "Test"

version := "1.0"

scalaVersion := "2.11.7"

resolvers ++= Seq(
 
"Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
)

libraryDependencies ++= Seq(
 
"org.reactivemongo" %% "reactivemongo" % "0.11.7"
)


[info] Running TestMongo 
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
{
  result: [
    0: {
      _id: BSONObjectID("55f01130ad94330a95bfc128"),
      foo: "bar"
    }
  ],
  ok: BSONDouble(1.0)
}

And app is still running. I need press Ctrl+C to exit.

What i'm doing wrong? And what "ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console." ?


Cédric Chantepie

unread,
Sep 10, 2015, 3:32:35 AM9/10/15
to ReactiveMongo - http://reactivemongo.org
You'd better use the ReactiveMongo aggregate framework (rather than RAW command): http://reactivemongo.org/releases/0.11/documentation/advanced-topics/aggregation.html .

Хандрамай Павел

unread,
Sep 10, 2015, 4:40:57 PM9/10/15
to reacti...@googlegroups.com
I get this code from http://reactivemongo.org/releases/0.11/documentation/advanced-topics/commands.html . And aggregate is just example. Instead it can be "count" command or another one.

ReactiveMongo does not involve the use of RAW command ?

To reproduce not necessary any command. Enough connect to the database.

val db = connection.db("test")
On Thu, Sep 10, 2015 at 10:32 AM, Cédric Chantepie <chantep...@gmail.com> wrote:
You'd better use the ReactiveMongo aggregate framework (rather than RAW command): http://reactivemongo.org/releases/0.11/documentation/advanced-topics/aggregation.html .

--
You received this message because you are subscribed to a topic in the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/reactivemongo/8ygxmoaSmQY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to reactivemong...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
С уважением,
Хандрамай Павел Александрович

Cédric Chantepie

unread,
Sep 11, 2015, 3:26:18 AM9/11/15
to ReactiveMongo - http://reactivemongo.org
The command API is there to call feature not implemented as operation on database or collection API. Aggregate or count operations are available on collection.

Cédric Chantepie

unread,
Sep 11, 2015, 7:08:34 AM9/11/15
to ReactiveMongo - http://reactivemongo.org
Running the following code with sbt run, the application is shutting down properly.

import scala.concurrent.ExecutionContext.Implicits.global

import reactivemongo.api._

object Main extends App {
  lazy val md
= MongoDriver()

 
try {
    val con
= md.connection(Seq("localhost:27017"))
    con
.db("test")
 
} finally {
    md
.close()
 
}
}


Павел Хандрамай

unread,
Sep 11, 2015, 7:23:10 AM9/11/15
to ReactiveMongo - http://reactivemongo.org
Yes, you are right. Sorry, my mistake.
Reply all
Reply to author
Forward
0 new messages