summaryrefslogtreecommitdiff
path: root/jstests/core/loglong.js
blob: 06cbf296c091ee4b29cbb02bb1e9edd6dafaa6a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// test for SERVER-5013
// make sure very long long lines get truncated

t = db.loglong;
t.drop();

t.insert( { x : 1 } );

n = 0;
query = { x : [] }
while ( Object.bsonsize( query ) < 30000 ) {
    query.x.push( n++ );
}

before = db.adminCommand( { setParameter : 1 , logLevel : 1 } )

t.findOne( query )

x = db.adminCommand( { setParameter : 1 , logLevel : before.was } )
assert.eq( 1 , x.was , tojson( x ) )

log = db.adminCommand( { getLog : "global" } ).log

found = false
for ( i=log.length - 1; i>= 0; i-- ) {
    if ( log[i].indexOf( "warning: log line attempted (16k)" ) >= 0 ) {
        found = true;
        break;
    }
}

assert( found )