private void emitLogHeader ( Context context , String mapredTaskId ) throws IOException , InterruptedException { Configuration conf = context . getConfiguration ( ) ; Text textId = new Text ( mapredTaskId ) ; for ( Map . Entry < String , String > entry : conf ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( entry . getKey ( ) ) ; sb . append ( "=" ) ; sb . append ( entry . getValue ( ) ) ; context . write ( textId , new Text ( sb . toString ( ) ) ) ; } context . write ( textId , new Text ( "----- Properties -----" ) ) ; String [ ] plist = { "mapred.local.dir" , "mapred.child.java.opts" , } ; for ( String k : plist ) { String v = conf . get ( k ) ; if ( v == null ) { v = "(null)" ; } context . write ( textId , new Text ( k + " " + v ) ) ; } String userDir = System . getProperty ( "user.dir" ) ; context . write ( textId , new Text ( "user.dir " + userDir ) ) ; try { java . net . InetAddress localMachine = java . net . InetAddress . getLocalHost ( ) ; context . write ( textId , new Text ( "hostname " + localMachine . getHostName ( ) ) ) ; } catch ( java . net . UnknownHostException uhe ) { // handle exception } }
Emit a bunch of logging output at the beginning of the map task .