def _setup_component(self, storm_conf, context):
self.topology_name = storm_conf.get("<STR_LIT>", "<STR_LIT>")<EOL>self.task_id = context.get("<STR_LIT>", "<STR_LIT>")<EOL>self.component_name = context.get("<STR_LIT>")<EOL>if self.component_name is None:<EOL><INDENT>self.component_name = context.get("<STR_LIT>", {}).get(<EOL>str(self.task_id), "<STR_LIT>"<EOL>)<EOL><DEDENT>self.debug = storm_conf.get("<STR_LIT>", False)<EOL>self.storm_conf = storm_conf<EOL>self.context = context<EOL>self.logger = logging.getLogger("<STR_LIT:.>".join((__name__, self.component_name)))<EOL>log_path = self.storm_conf.get("<STR_LIT>")<EOL>log_file_name = self.storm_conf.get(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>",<EOL>)<EOL>root_log = logging.getLogger()<EOL>log_level = self.storm_conf.get("<STR_LIT>", "<STR_LIT:info>")<EOL>if log_path:<EOL><INDENT>max_bytes = self.storm_conf.get("<STR_LIT>", <NUM_LIT>)  <EOL>backup_count = self.storm_conf.get("<STR_LIT>", <NUM_LIT:10>)<EOL>log_file = join(<EOL>log_path,<EOL>(<EOL>log_file_name.format(<EOL>topology_name=self.topology_name,<EOL>component_name=self.component_name,<EOL>task_id=self.task_id,<EOL>pid=self.pid,<EOL>)<EOL>),<EOL>)<EOL>handler = RotatingFileHandler(<EOL>log_file, maxBytes=max_bytes, backupCount=backup_count<EOL>)<EOL>log_format = self.storm_conf.get(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>" "<STR_LIT>",<EOL>)<EOL><DEDENT>else:<EOL><INDENT>self.log(<EOL>"<STR_LIT>"<EOL>'<STR_LIT>'<EOL>"<STR_LIT>".format(log_level)<EOL>)<EOL>handler = StormHandler(self.serializer)<EOL>log_format = self.storm_conf.get(<EOL>"<STR_LIT>", "<STR_LIT>" "<STR_LIT>"<EOL>)<EOL><DEDENT>formatter = logging.Formatter(log_format)<EOL>log_level = _PYTHON_LOG_LEVELS.get(log_level, logging.INFO)<EOL>if self.debug:<EOL><INDENT>log_level = logging.DEBUG<EOL><DEDENT>handler.setLevel(log_level)<EOL>handler.setFormatter(formatter)<EOL>root_log.addHandler(handler)<EOL>self.logger.setLevel(log_level)<EOL>logging.getLogger("<STR_LIT>").setLevel(log_level)<EOL>if self.serializer.output_stream == sys.stdout:<EOL><INDENT>sys.stdout = LogStream(logging.getLogger("<STR_LIT>"))<EOL><DEDENT>
Add helpful instance variables to component after initial handshake
        with Storm.  Also configure logging.